- Home /
steerAngle keeps the wheel spinning
This is the code I used to control the steering and collision of my basic vehicle. When I try it out my front wheels are spinning round and round, why?
thanks for the respons
var a = 50;
var RL : Transform;
var RR : Transform;
var FL : Transform;
var FR : Transform;
var rl : WheelCollider;
var rr : WheelCollider;
var fl : WheelCollider;
var fr : WheelCollider;
var ground : boolean;
function Update () {
if(FL.collider.isGrounded || FL.collider.isGrounded || RL.collider.isGrounded || RR.collider.isGrounded) {
GetComponent("movement").grounded = true;
ground = true;
}
else {
GetComponent("movement").grounded = false;
ground = false;
}
var steer = Input.GetAxis("Horizontal")*a/rigidbody.velocity.magnitude;
fr.steerAngle = steer;
fl.steerAngle = steer;
}
Comment
Your answer
Follow this Question
Related Questions
Car steer problem 0 Answers
Problem with my car enter/exit script 1 Answer
Car Physics Help 0 Answers
vehicle decceleration and angle reseting 1 Answer
How to make a steering wheel that rotates when wheels do? 0 Answers