Hey guys; I have code that uses this code:
RV = GetVehicleSteeringAngle(vehicle)
SetVehicleSteeringAngle(vehicleHandle, RV)
Get steering angle of RV tugging entity;
then set the steering of the vehicle being tugged to the tugger’s vehicle; While this works wonders, the problem is that that’s not how physics works. Physics dictate that the vehicle being towed’s front wheels should match the DIRECTION of the vehicle ahead rather than the STEERING ANGLE of the vehicle ahead.
The problem is that I don’t know how to get this value. It seems steering angle is a vary low decimal number denoted by a negative scientific notation-stored value, but I have no clue how to calculate that relative to the entity; Any ideas?
Thanks for your help in advance! 
Not exactly; Allow me to share a screenshot of this;
As you can see, these values are of different datatypes; And unfortunately, I don’t know how the steering angle is calculated so I can’t use math to match the angle of the first vehicle;
Like I understand what you’re saying but the heading isn’t a valid input type for SetVehicleSteeringAngle, ya know?
I’m not following, any example of real life or paint?
Sure; Check this out!
Notice how the front wheel of the back vehicle is based on the direction of the front vehicle?
And because the steering angle gets a number that is hard to calculate, I can’t just use heading to get it (at least until I understand the formula!)
Forfex
7
If Im understanding you right u just need to calculate the angle basing on vehicle’s headings
1 Like
Hmmm; That kind of makes sense, but a few questions:
- How can I calculate the angle if the heading is a single element and not a vector?
- Understanding that heading is a special unit of measurement, what happens if we run into an edge case where heading is 359 and 0 (or vice versa?)
- How can we convert that into the -1, 0, +1 range of the natives “steeringbias” / “steeringangle?”
Forfex
9
Tbh I would have to think a little or do research to know how to do that, so I can’t give u an answer
No problem; I’ve been looking at something called the bearing, and am seeing how it’s possible to calculate that, but if you come across something, please lmk!
ShahZaM
11
You know that doesn’t happen in real life, right?
Yeah but…rockstar physics
so…