How to use this function?

Started by MatheuS, Jan 06, 2015, 04:45 AM

Previous topic - Next topic

MatheuS

someone can tell me how to use this function?

vehicle.Angle ?

use only when the function vehicle.Pos the angle goes wrong.
if( !sucess ) tryAgain();
Thanks to the VCMP community. It was the happiest period of my life.

Honey

Vehicle.Angle.x
Vehicle.Angle.y
Vehivle.Angle.z

MatheuS

if( !sucess ) tryAgain();
Thanks to the VCMP community. It was the happiest period of my life.

Honey

#3
I also had many problems using Vehicle.Angle because I thought that you can just set it like this Vehicle.Angle = 1; but this crashes the server. Then i went to the source code and studied it's parameters,

Here's how you use it :

player.Vehicle.Angle.x = 11.55;
player.Vehicle.Angle.y = 11.55;
player.Vehicle.Angle.x = 11.55;

OR

player.Vehicle.Angle = Quaternion( X, Y, Z, W ); The parameters should be in float

I used them to get vehicle angles from an ini so that the vehicle would move on it's own,. You can study my code here :

local coord = ReadIniString( "Files/Malibu.ini", "Position" + taxia[ plr.ID ].Malibu , "Pos" + taxia[ plr.ID ].Malibu );
local split1 = split( coord, " " );
plr.Vehicle.EulerRotation.x = split1[3].tofloat();
plr.Vehicle.EulerRotation.y = split1[4].tofloat();
plr.Vehicle.EulerRotation.z = split1[5].tofloat();
plr.Vehicle.Pos = Vector(split1[0].tofloat(), split1[1].tofloat(), split1[2].tofloat() );
taxia[ plr.ID ].Malibu++;

.

Quote from: Honey on Jan 06, 2015, 07:58 AMI also had many problems using Vehicle.Angle because I thought that you can just set it like this Vehicle.Angle = 1; but this crashes the server.

You can't use that directly because Angle is a Quaternion and the Quaternion class doesn't have an implicit integer constructor. Actually I'm not sure if Squirrel uses implicit constructors. Your code would have to be explicit in order for that to work:
Vehicle.Angle = Quaternion(1, 1, 1, 1) // x, y, z, w
.

MatheuS

local veh = player.Vehicle;
veh.Angle = Quaternion(0.864632, -0.000780538, -0.00151615, 0.502404);

more rotation is wrong, the car is down :o

I use "+ veh.Angle +" to get the coordinates (and an example of this)
if( !sucess ) tryAgain();
Thanks to the VCMP community. It was the happiest period of my life.

Honey

Try EulerRotation see example in my code.

MatheuS

veh.EulerRotation.x = 0;
veh.EulerRotation.y = 0;
veh.EulerRotation.z = 1;

do not know why I used that's worked!
if( !sucess ) tryAgain();
Thanks to the VCMP community. It was the happiest period of my life.