Author Topic: VelX and VelY  (Read 1046 times)

0 Members and 1 Guest are viewing this topic.

Offline Avarax

  • Veteran
  • *****
  • Posts: 1529
    • Official Hexer & MMod site
VelX and VelY
« on: August 23, 2007, 05:21:43 pm »
They return 0 for me everytime I use them. :(
I like to have one Martini
Two at the very most
Three I'm under the table
Four I'm under the host

Offline sai`ke

  • Camper
  • ***
  • Posts: 318
  • Can't be arsed to remove christmas avatar
Re: VelX and VelY
« Reply #1 on: August 24, 2007, 07:00:03 am »
Hehe yeah, same. I remember I needed it when I wanted to check how fast a bot was moving because I wanted to spawn a circle of flames around it without damaging it. Decided to make him invincible to his own bullets instead tho'. Less hassle.

Date Posted: August 23, 2007, 09:16:34 PM
Oh, by the way, if it's a problem and you've got processing time to spare, you can just do the following:
Make an array with positions and speeds (or velx and vely if you prefer) with enough space for each player (clear it on mapchange, onjoin, onrespawn and onleave)

speed[playernumber] = Distance( lastpositionx[playernumber], lastpositiony[playernumber], x[playernumber], y[playernumber] ) / numberoftickspassed

or

velX[playernumber] = ( x[playernumber] - lastpositionx[playernumber] ) / Timepassed
velY[playernumber] = ( y[playernumber] - lastpositiony[playernumber] ) / Timepassed

in AppOnIdle. Cumbersome, but it'd give you a measure of the velocity at least. Heavy on larger numbers of players tho'.
#soldat.ttw #ttw.gather --- Quakenet!
http://ttwforums.com

Offline EnEsCe

  • Retired Soldat Developer
  • Flamebow Warrior
  • ******
  • Posts: 3101
  • http://enesce.com/
    • [eC] Official Website
Re: VelX and VelY
« Reply #2 on: August 24, 2007, 08:15:07 am »
Woops, ill fix it eventually.

Offline Avarax

  • Veteran
  • *****
  • Posts: 1529
    • Official Hexer & MMod site
Re: VelX and VelY
« Reply #3 on: August 24, 2007, 09:41:14 am »
sai'ke, a sleep(1) should work to calculate the velocity much more accurately
@EnEsCe:
Yay ;) -> PM
I like to have one Martini
Two at the very most
Three I'm under the table
Four I'm under the host

Offline sai`ke

  • Camper
  • ***
  • Posts: 318
  • Can't be arsed to remove christmas avatar
Re: VelX and VelY
« Reply #4 on: August 24, 2007, 02:04:22 pm »
Thanks :)
#soldat.ttw #ttw.gather --- Quakenet!
http://ttwforums.com