Vice City Multiplayer

VC:MP 0.3 => mIRC/pawn Scripting => Topic started by: DilsonTB on March 20, 2012, 01:50:21 pm

Title: How to get Angle in vehicle
Post by: DilsonTB on March 20, 2012, 01:50:21 pm
I made a /c parkcar so i need to get the angle of the vehicle but when i am out of it, the angle show me rightly, when i am inside it show me like this 0.0000000 and its the variable to the north, So please help me any idea of take the vehicle angle.

PLEASE
Title: Re: How to get Angle in vehicle
Post by: stormeus on March 20, 2012, 09:56:44 pm
A vehicle's z-angle cannot be retrieved in r2.
Title: Re: How to get Angle in vehicle
Post by: [AoD]NC on March 21, 2012, 01:46:58 am
You can do /s and read it from the chatbox.
Title: Re: How to get Angle in vehicle
Post by: DilsonTB on March 21, 2012, 09:08:14 pm
Well as i said before i want to make it to fix the Angle 0.00000000 on my list of vehs that i have...... I already did the whole script of saving coords, model, color etc but i need to know how to fix it to add it to /c parkcar so.... Any other way?
Title: Re: How to get Angle in vehicle
Post by: aXXo on March 23, 2012, 03:01:08 pm
There is a complicated method. Though I would not guarantee its accuracy.

Fetch X,Y pos of the car.
Lets call them X1, Y1.

Accelerate the car in forward direction (without turning).
Stop the car.
Fetch X,Y pos again.
Call them X2, Y2.

Angle = tan-1 [ (Y2 - Y1)/(X2 - X1) ]

You can use a timer to get X2, Y2 while you are driving.
Title: Re: How to get Angle in vehicle
Post by: stormeus on March 23, 2012, 10:23:19 pm
Well, the angle (if in radians) would have to be converted to a degree measure out of 360. Regardless, that wouldn't capture the facing (vehicle z) angle.

(http://i.imgur.com/COftd.jpg)
Title: Re: How to get Angle in vehicle
Post by: [AoD]NC on March 24, 2012, 12:42:27 am
+ tan is periodic for (-Pi/2, Pi/2) so it will return the same value for 0 degrees and 180, so without more IFs, he won't get the angle anyway.

I really thinks that /s should do everything, cmon! I use it sometimes even if I need some player pos + angle for single player modifications ::).

Or have you thought about player angle? If it works, just set your character, return it;s angle and set it to your car.