Hi,
I am able to move vehicle forward by using the following code, however, I am not able to do any rotation on the front wheels. I tried to set target rotation, setting limit rotation along y-local axis and nothing works. Could someone please give me a pointer how this should be done?
I set both target rotation to 35 in the inspector, but it won’t budge.
function FixedUpdate() {
var axisVertPos : float = Input.GetAxis("Vertical");
var axisHorizontal : float = Input.GetAxis("Horizontal");
frontLeftWheel.targetRotation.y = axisHorizontal * turning;
frontRightWheel.targetRotation.y = axisHorizontal * turning;
frontLeftWheel.targetAngularVelocity = Vector3(axisVertPos * maxAngularVelocity, 0, 0);
frontRightWheel.targetAngularVelocity = Vector3(axisVertPos * maxAngularVelocity, 0, 0);
rearLeftWheel.targetAngularVelocity = Vector3(axisVertPos * maxAngularVelocity, 0,0);
rearRightWheel.targetAngularVelocity = Vector3(axisVertPos * maxAngularVelocity, 0,0);
//Debug.Log(rearRightWheel.targetAngularVelocity.x + " " + frontRightWheelTransform.transform.eulerAngles.y + " " + frontRightWheel.targetRotation.y);
}