Home   Help Search Login Register  

Author Topic: set velocity wont work  (Read 880 times)

0 Members and 1 Guest are viewing this topic.

acepilotray

  • Guest
set velocity wont work
« on: 05 Sep 2005, 05:41:39 »
when i try to use this setvelocity 10 i get a message that says "unknown operator setvelocity"
how do i use the setveloty code

Offline Fragorl

  • Coding Team
  • Former Staff
  • ****
Re:set velocity wont work
« Reply #1 on: 05 Sep 2005, 06:32:22 »
SetVelocity.

Velocity takes an array of 3 numbers, similar to setpos.

example
plane setvelocity [100,100,0]

The numbers say in which direction along each of the axes, and how fast, the plane travels.
The numbers do not depend on the direction the plane is facing. Rather they relate to directions on the map. The first number is the east-to-west component (+100 means going east on the map). the second is the south-to-north component (+100 means north). The third number is the upwards/downwards component. +10 would mean up. -10 would mean down.

How fast the plane travels after this can be calculated by pythagoras' theorem.

You can also calculate the direction of movement using trig. Using the sin and cos functions, you can make the plane move in what ever direction it's facing.

Example
car setvelocity [10*sin(getdir car),10*cos(getdir car),0]
« Last Edit: 05 Sep 2005, 06:34:05 by Fragorl »

Offline macguba

  • Former Staff
  • ****
    • macguba's operation flashpoint page
Re:set velocity wont work
« Reply #2 on: 05 Sep 2005, 12:10:30 »
Velocity is a vector:  it has both magnitude and direction.

Speed is a scalar:  it has only magnitude.

Velocity and speed are fundamentally different.
Plenty of reviewed ArmA missions for you to play

2nd Ranger

  • Guest
Re:set velocity wont work
« Reply #3 on: 05 Oct 2005, 20:06:08 »
Hello,

I have been wondering about this for a while. I was curious if setvelocity could determine the speed of a chopper when the game begins.

What I mean by that is - if you start a chopper in the air, the mission doesn't begin with the chopper flying along its waypoint. It first has to accelerate before it actually moves. Could setvelocity be used to make the helo be moving when the mission starts?

If not, is there another way to do this?

Kyle Sarnik

  • Guest
Re:set velocity wont work
« Reply #4 on: 05 Oct 2005, 21:00:30 »
Hello,

I have been wondering about this for a while. I was curious if setvelocity could determine the speed of a chopper when the game begins.

What I mean by that is - if you start a chopper in the air, the mission doesn't begin with the chopper flying along its waypoint. It first has to accelerate before it actually moves. Could setvelocity be used to make the helo be moving when the mission starts?

If not, is there another way to do this?

You could, but I would advise against that. I know from experience that it is crucial to let the AI choppers do their thing at the start of a mission. The reason it takes AI so long to start moving at the start of a mission is because they first have to climb/descend to the proper altitude that they wish (or are ordered) to fly at. AI are very anal about this, and will do this before even starting to move forward. If you force him to go right away, I can't garuntee that he won't stop or slow down to adjust his altitude. Another thing is that if you use setvelocity at the start, its like pushing the helicopter forward before its ready to fly forward (it will still be level, won't have enough horizontal thrust, etc...) and so that can cause problems too. I don't understand why you just can't wait a little for the chopper to start, it only takes a few seconds. And if you don't want anyone to notice, then just black the screen out for a few seconds.

Offline Triggerhappy

  • Contributing Member
  • **
  • Llama, it's what's for dinner.
Re:set velocity wont work
« Reply #5 on: 05 Oct 2005, 22:32:16 »
@acepilotray
(in addition to what mac and frag said) you need to use trig to do what you're trying. since setvelocity is not relative to the unit it is affecting, you need to factor in the direction of the thing you're setting the velocity for

so, the code for pushing it 10 m/s in the direction its facing:

this setvelocity [10*cos(getdir this),10*sin(getdir this),0]
« Last Edit: 05 Oct 2005, 22:34:58 by Triggerhappy »