Home   Help Search Login Register  

Author Topic: setvelocity command?  (Read 583 times)

0 Members and 1 Guest are viewing this topic.

Offline Zombie

  • Members
  • *
  • Beware the night, the zombie walks among you
    • USI
setvelocity command?
« on: 24 Mar 2004, 16:30:42 »
can some please give me a quick explaination of setvelocity?  I know the correct syntax:

unit setvelocity [x,z,y]

but what exactly is x,z,y  ?

I assume it to be:
x  forward
z vertical
y lateral

so a setvelocity of [200,0,0] would make the unit go 200 speed directly forward?
also is this an instantaneous change or a very quick acceleration, say a unit going 100 hits a trigger with setvelocity [200,0,0] does it quickly accelerate to 200 or instantly start going 200?
« Last Edit: 24 Mar 2004, 16:33:13 by Zombie »

sa8gecko

  • Guest
Re:setvelocity command?
« Reply #1 on: 24 Mar 2004, 17:06:48 »
No: x is the component of the velocity along the x axis,
y is the component along the y axis and z is the component along the z axis.
And these components are in meters/seconds , not KM/h.
So you can figure out that both the answers you gave to your question
are wrong (no acceleration). With a little trigonometry, though, you can
achieve the wanted result.

Offline Zombie

  • Members
  • *
  • Beware the night, the zombie walks among you
    • USI
Re:setvelocity command?
« Reply #2 on: 24 Mar 2004, 19:47:56 »
ok, I understood that it was along certain axis, but my trig days were like 25 years ago.  What are the axis?  say I'm moving north, 0 degrees, at an altitude of 100, then what is the x , y, and z in relation to my movement ?

Kaliyuga

  • Guest
Re:setvelocity command?
« Reply #3 on: 24 Mar 2004, 19:56:00 »
unit setvelocity [x,z,y]

x = Left/Right    + number = Right   - number= Left

z = Forward/Reverse  + number=Forward   - number= Reverse

y = Vertical axis   + number = up   - number = down

:toocool:

sa8gecko

  • Guest
Re:setvelocity command?
« Reply #4 on: 24 Mar 2004, 20:06:22 »
x is along west-east axis, x increasing from left to right
y is along north-south axis, I think y increasing from top to bottom,
but I must check this (maybe it's from bottom to top, you can easily discover
this placing a unit near the bottom border of the map and 'hint-ing' its
position)
z is along the vertical axis.

So, if you are moving north (perfectly north) at a fixed height of 100m,
velocity will return something like : [0,y,0] where y is the speed in m/s
RELATIVE to the position of the unit (so, it can be negative even if your unit is not
moving backward)
 
To find the direction (in the x,y) plane use ATAN2:
_unitdirection = [velocity _unit select 0] ATAN2 [velocity _unit select 1].
Be advised ATAN2 returns angles between -180/+180, but this will work

anyway with the setdir command, only you can have some problems if
you try to compares angles.

Kaliyuga: negative y value doesn't mean reverse or forward.
It's relative to the unit itself. And for the x component,
the same applies.
« Last Edit: 24 Mar 2004, 20:21:35 by sa8gecko »

Offline Planck

  • Honoured
  • Former Staff
  • ****
  • I'm never wrong ....I'm just not always right !
Re:setvelocity command?
« Reply #5 on: 24 Mar 2004, 22:57:24 »
Like Ka;iyuga, my understanding was that the x axis was West-East, z axis was South-North and the y axis was elevation up or down.


Planck
I know a little about a lot, and a lot about a little.

Kaliyuga

  • Guest
Re:setvelocity command?
« Reply #6 on: 24 Mar 2004, 23:15:43 »
yeah I tried it out before I posted..
 didn't think to remember that it does depend on what direction on the map you're facing ...

so it's not  

left/right    forward/reverse

but  like you guys said  west/east  north/south

but using negative numbers in the array does indeed make you move in the opposite direction then if you used positive ones...  

as always the best way is just to throw some numbers in the array and see what you come up with to suit your specific needs

... nothing bad will come of it.. and more than likely you'll get a few laughs out of the experience..  and maybe some funny screenshots as well..


:cheers:
« Last Edit: 24 Mar 2004, 23:17:47 by Kaliyuga »