Author Topic: How to get Angle in vehicle  (Read 3366 times)

0 Members and 1 Guest are viewing this topic.

Offline DilsonTB

  • Made Man
  • ***
  • Posts: 140
  • VC:MP Developer. & SA:MP Currently Developer
    • View Profile
How to get Angle in vehicle
« 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
_______________________________________________
¬ VC:MP Squirrel Developer.
¬ VC:MP pawno Developer.
¬ SA:MP Developer.
¬
¬ Actually developing " San Fierro Roleplay - Latino ", with
my beta team testers, Mapper + Scripter ( me ), 18,000
lines, and is 34% finished. hope to finish it in 4 Or 3 Months.

- MYSQL FULL BASED.
- PCU.
_______________________________________________

Offline stormeus

  • VC:MP Developer
  • VC:MP Veteran
  • *
  • Posts: 1122
    • View Profile
Re: How to get Angle in vehicle
« Reply #1 on: March 20, 2012, 09:56:44 pm »
A vehicle's z-angle cannot be retrieved in r2.
Do not PM me for support.




Offline [AoD]NC

  • VC:MP Beta Tester
  • VC:MP Veteran
  • *
  • Posts: 616
  • AoD forever!
    • View Profile
    • KURWA MAĆ
Re: How to get Angle in vehicle
« Reply #2 on: March 21, 2012, 01:46:58 am »
You can do /s and read it from the chatbox.

Offline DilsonTB

  • Made Man
  • ***
  • Posts: 140
  • VC:MP Developer. & SA:MP Currently Developer
    • View Profile
Re: How to get Angle in vehicle
« Reply #3 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?
_______________________________________________
¬ VC:MP Squirrel Developer.
¬ VC:MP pawno Developer.
¬ SA:MP Developer.
¬
¬ Actually developing " San Fierro Roleplay - Latino ", with
my beta team testers, Mapper + Scripter ( me ), 18,000
lines, and is 34% finished. hope to finish it in 4 Or 3 Months.

- MYSQL FULL BASED.
- PCU.
_______________________________________________

Offline aXXo

  • Wiseguy
  • **
  • Posts: 50
    • View Profile
Re: How to get Angle in vehicle
« Reply #4 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.

Offline stormeus

  • VC:MP Developer
  • VC:MP Veteran
  • *
  • Posts: 1122
    • View Profile
Re: How to get Angle in vehicle
« Reply #5 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.

Do not PM me for support.




Offline [AoD]NC

  • VC:MP Beta Tester
  • VC:MP Veteran
  • *
  • Posts: 616
  • AoD forever!
    • View Profile
    • KURWA MAĆ
Re: How to get Angle in vehicle
« Reply #6 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.