Unexpected Vehicle Behaviour

Started by Honey, Oct 24, 2014, 11:09 AM

Previous topic - Next topic

Honey

Hello,

I was trying to make something similar to taxi server in VC but I'm having a weird problem.The Positions are stored properly and they should be loaded properly too but when i try to move a vehicle it starts to move up and down and behaves unexpectedly.



These are my positions : https://www.mediafire.com/?b31wzwxzze2906i

Thijn


Honey

#2
Now i know some information about the vehicle angle but I have a new problem.When i try to change the direction of my vehicle through angles nothing happens and the vehicle spawns with its original angle )

local coord = ReadIniString( "Files/taxi.ini", "Position" + a, "Pos" + a );
local split1 = split( coord, " " );
local pos = Vector(split1[0].tofloat(), split1[1].tofloat(), 40.0000 );
plr.Vehicle.Angle.x = split1[3].tofloat()
plr.Vehicle.Angle.y = split1[4].tofloat()
plr.Vehicle.Angle.z = split1[5].tofloat()
plr.Vehicle.Angle.w = split1[6].tofloat()

plr.Vehicle.Pos = pos;
//plr.Vehicle.Pos = pos;
a++;

Part of my INI File( the first 3 are Vectors and others are quaternions )  :

[position0]
pos0                           = -295.1447 -481.5813 10.7936 0.6787 -0.0023 -0.0049 0.7344


[position1]
pos1                           = -295.1447 -481.5813 10.7936 0.6787 -0.0023 -0.0049 0.7344


[position2]
pos2                           = -295.1447 -481.5813 10.7936 0.6787 -0.0023 -0.0049 0.7344

Honey

Rebump! I tried to use radians but they do not change the vehicle angle either.

Gudio

I'd suggest you to save&read vehicle's speed with angle instead of vehicle positions. It will look smooth.
vehicle.Speed = saved vector speed;
vehicle.Angle = saved radians angle;

Honey

But the vehicle doesn't move according to the angle i save.As you can see in the INI file above player.Angle has 4 Quaternions but when I try to use them with Quaternion( x, y, z, w ) vehicle still moves in a wrong angle.

Gudio

Can you try to use EulerRotation?

Honey

I tried to use it but still doesn't work, :-\

MacTavish

#8
Same problem for me suppose if our vehicle angle is in North side but in server it will spawn in East side

Also
My server.exe crash when ever i enter vehicle

Grand Hunting Project
Join #SLC, #KAKAN, #Doom, #GHP @LUnet

Retired VC:MP Player/Scripter :P

Honey

#9
@The Topic, I fixed this problem long ago but didn't bother to post :P, Therefore this topic is now Marked as "Solved", Thanks to Gudio.

@Rathore, The Vehicle Angles are retrieved in Angle.x, Angle.y and angle.z

so Here's what I Do to set my vehicle angle( I use Vehicle.EulerRotation ) :

/*There's no need to provide the whole code to understand how to set a vehicle angle so I am just going to show you a couple of lines. */

buscar.EulerRotation.x = split1[3].tofloat();
buscar.EulerRotation.y = split1[4].tofloat();
buscar.EulerRotation.z = split1[5].tofloat();

// Buscar is a variable for a vehicle,For players  You can use player.Vehicle.EulerRotation.
// As for Angles you can also use player.Vehicle.Angle.x, y, and z.

Btw, Thanks for Hijacking my topic.

Thijn

buscar.EulerRotation.x = ..
buscar.Vehicle.EulerRotation.y = ..

Are you sure?
Is buscar a player or a vehicle?

Honey

#11
It's a global variable used for a vehicle, A Bus.

buscar <- CreateVehicle( 167, 0, Vector( -1448.63, -785.747, 14.2235 ),1, 0, 0 ) 
// buscar.Vehicle.EulerRotation.y was mispelled, I updated my post.