Reputation: 909
I have 2 variables.
float Speed;
float SteeringAngle;
My speed value currently increases. What I want to do is reduce the steering angle as speed increases. It should be a simple equation but I can't seem to work it out.
Thanks
Upvotes: 0
Views: 1562
Reputation: 39404
You could try this formula:
.
float factor;
float maxSpeed;
float requestedAngle;
float Speed;
float SteeringAngle = requestedAngle/( (Speed * factor / maxSpeed) + 1);
There are many possible formulas.
I would suggest you try to plot graphs of speeds and angles
Upvotes: 1
Reputation: 490573
The obvious approach would be something like:
Speed = factor / steeringAngle;
Edit: oops -- I misread your request. If you want to reduce the steering angle as the speed increases, you'd want something like:
if (speed > 0)
steeringAngle -= factor / speed;
Upvotes: 1