SetVehicleVelocity(Help Please)
#1

thanks all
Reply
#2

this will help:
1.5*x
1.5*y
1.5*z
or 2.0

+y = north
-y = south
+x = east
-x = west
+z = up
-z = down
Reply
#3

Quote:
Originally Posted by Doerfler
this will help:
1.5*x
1.5*y
1.5*z
or 2.0

+y = north
-y = south
+x = east
-x = west
+z = up
-z = down
Basically what he said, if you add or subtract the values it only goes the certain direction, the only way to increase speed in any direction is to multiply X and Y by the same value so the ratio between both X and Y stays the same
Reply
#4

hm...
if(Angle,90.0 <= 0) SetVehicleVeloCity......
yes or no?
Reply
#5

Quote:
Originally Posted by kruts
hm...
if(Angle,90.0 <= 0) SetVehicleVeloCity......
yes or no?
No the facing angle doesn't matter with SetVehicleVelocity or SetPlayerVelocity.
the function sets the velocity in a specific direction, X, Y, and Z
Notice on your minimap there's a N on the top? thats north
so if you input SetVehicleVelocity(vehicleid, 0, 1, 0) your vehicle would slowly go north
if you input SetVehicleVelocity(vehicleid, 0, 0, 2) your vehicle would jump up
if you input SetVehicleVelocity(vehicleid, 0, -2, ) your vehicle would go south because the opposite of north is south
now if you input SetVehicleVelocity(vehicleid, 1, 1, 0) your vehicle will speed up North and East by the velocity of 1, and the resulting vector or path would be the the middle or North East
This isn't like SetPlayerPos
this is just Speed with given directions
if you setup a command that get the vehicle's velocity, and then multiply it by a certain number, then you can speed up in any direction you are facing since the ratio is the same (1/2 = 2/4)
Reply
#6

let's see if i still remember how to do this

pawn Код:
new Float:x, Float:y, Float:z, Float:angle, carid;
carid = GetPlayerVehicleID(playerid);
GetVehicleVelocity(carid, x, y, z);
GetPlayerZAngle(carid, angle);
x = 0.2 * floatcos(angle + 90.0, degrees) + x;
y = 0.2 * floatsin(angle + 90.0, degrees) + y;
SetVehicleVelocity(carid, x, y, z);
if you find it is always going at a certain angle to the way you are facing, just change the + 90.0 to some dif numbers till you get it right.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)