Quantcast

Jump to content

» «
Photo

Roll/Pitch/Yaw data when driving

5 replies to this topic
swiveldemon
  • swiveldemon

    Player Hater

  • Members
  • Joined: 01 Dec 2016
  • United-States

#1

Posted 01 December 2016 - 11:10 PM

When driving a car, I'm interested in being able to access things like roll, pitch, and yaw of the car (how much it is tilted and how much it has turned). Is this something that is possible?

 

Any help or links to helpful resources would be much appreciated!

 

Thanks!

 

sd


Jitnaught
  • Jitnaught

    Grass tastes bad

  • Members
  • Joined: 24 Aug 2013
  • United-States

#2

Posted 02 December 2016 - 01:08 AM

.NET:

if (Game.Player.Character.IsInVehicle())
{
    Vector3 rotation = Game.Player.Character.CurrentVehicle.Rotation;
}

C++:

if (PED::IS_PED_IN_ANY_VEHICLE(PLAYER::PLAYER_PED_ID() false))
{
    Vector3 rotation = ENTITY::GET_ENTITY_ROTATION(PED::GET_VEHICLE_PED_IS_IN(PLAYER::PLAYER_PED_ID(), false));
}

swiveldemon
  • swiveldemon

    Player Hater

  • Members
  • Joined: 01 Dec 2016
  • United-States

#3

Posted 02 December 2016 - 01:13 AM

sweet thank you!

 

Also, do you know if there is a way to get the rotation rates? Having trouble finding it in the docs


Jitnaught
  • Jitnaught

    Grass tastes bad

  • Members
  • Joined: 24 Aug 2013
  • United-States

#4

Posted 02 December 2016 - 01:15 AM

You mean like the change in rotation?


swiveldemon
  • swiveldemon

    Player Hater

  • Members
  • Joined: 01 Dec 2016
  • United-States

#5

Posted 02 December 2016 - 01:21 AM

correct.

 

That and vehicle speed, current turning radius, etc.

 

Is there a doc you are looking at for this?


Jitnaught
  • Jitnaught

    Grass tastes bad

  • Members
  • Joined: 24 Aug 2013
  • United-States

#6

Posted 02 December 2016 - 01:41 AM Edited by Jitnaught, 02 December 2016 - 01:46 AM.

I don't think there is a native function for change in rotation. You'd have to subtract the current rotation by the last rotation.

//not sure what language you're using so here's an example for C#. don't actually use the wait(1000) in a mod
Vector3 oldRotation = Game.Player.Character.CurrentVehicle.Rotation;
Wait(1000);
Vector3 newRotation = Game.Player.Character.CurrentVehicle.Rotation;
Vector3 changeInRotation = newRotation - rotation;

Vehicle speed is:

float speed = Game.Player.Character.CurrentVehicle.Speed //c#


float speed = ENTIY::GET_ENTITY_SPEED(PED::GET_VEHICLE_PED_IS_IN(PLAYER::PLAYER_PED_ID(), false)); //c++

Turning radius is (.NET only):

Game.Player.Character.CurrentVehicle.SteeringAngle

Only documentation I look at is the Native DB. I also look at the source code of Script Hook V .NET.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users