This topic was marked solved by its starter, on November 18th, 2014, 12:41 PM

#### Honey

• Full Member
• Posts: 136
##### Unexpected Vehicle Behaviour
« on October 24th, 2014, 12:09 PM »
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

• VC:MP Beta Tester
• Posts: 1,689
##### Re: Unexpected Vehicle Behaviour
« Reply #1, on October 24th, 2014, 02:56 PM »
We need some code.

#### Honey

• Full Member
• Posts: 136
##### Re: Unexpected Vehicle Behaviour
« Reply #2, on October 25th, 2014, 10:04 AM »Last edited on October 25th, 2014, 02:01 PM
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 )

Code: [Select]
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 )  :

Code: [Select]
[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
##### Re: Unexpected Vehicle Behaviour
« Reply #3, on October 28th, 2014, 10:54 AM »
Rebump! I tried to use radians but they do not change the vehicle angle either.

#### Gudio

• Full Member
• Gudio.eu
• Posts: 125
##### Re: Unexpected Vehicle Behaviour
« Reply #4, on November 1st, 2014, 02:19 PM »
I'd suggest you to save&read vehicle's speed with angle instead of vehicle positions. It will look smooth.
Code: [Select]
vehicle.Speed = saved vector speed;

#### Honey

• Full Member
• Posts: 136
##### Re: Unexpected Vehicle Behaviour
« Reply #5, on November 2nd, 2014, 06:23 AM »
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

• Full Member
• Gudio.eu
• Posts: 125
##### Re: Unexpected Vehicle Behaviour
« Reply #6, on November 2nd, 2014, 09:17 AM »
Can you try to use EulerRotation?

#### Honey

• Full Member
• Posts: 136
##### Re: Unexpected Vehicle Behaviour
« Reply #7, on November 2nd, 2014, 01:07 PM »
I tried to use it but still doesn't work, :-\

#### MacTavish

• Hero Member
• Nicks( Kusanagi, Beztone, RATHORE )
• Posts: 809
##### Re: Unexpected Vehicle Behaviour
« Reply #8, on November 18th, 2014, 06:49 AM »Last edited on November 18th, 2014, 10:43 AM
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

• Full Member
• Posts: 136
##### Re: Unexpected Vehicle Behaviour
« Reply #9, on November 18th, 2014, 12:40 PM »Last edited on November 19th, 2014, 04:17 AM
@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 ) :

Code: [Select]
/*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

• VC:MP Beta Tester
• Posts: 1,689
##### Re: Unexpected Vehicle Behaviour
« Reply #10, on November 18th, 2014, 08:37 PM »
Code: [Select]
buscar.EulerRotation.x = ..
buscar.Vehicle.EulerRotation.y = ..

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

#### Honey

• Full Member
• Posts: 136
##### Re: Unexpected Vehicle Behaviour
« Reply #11, on November 19th, 2014, 04:11 AM »Last edited on November 19th, 2014, 04:18 AM
It's a global variable used for a vehicle, A Bus.

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