I have a raycast collider on a wheel object (no rigidbody) that I am rotating. At start, the wheel sits on the ground correctly. As the rotation starts, the wheel appears to sink into the ground some (not a lot) and stays there until the rotation has almost completed. As the rotation completes, the wheel appears to rise up back to the correct postions. The sinking and rising each occurs over approximately 45 degrees of rotation.
The transform of the wheel itself does not change its position at any time. The wheel is a child of a tranform with a rigidbody attached. The parent’t tranform postion and rotation do change when the tire rotates, cycling back to its original settings as a rotation completes.
If I do not do the rotation and only the steering, I do not have the problem.
Here is the wheel rotation code:
// The maximum steer
steerAngle = rotation * maxSteerAngle;
lastTireRotationAngle = ClampAngle(lastTireRotationAngle + wheelRotateSpeed, -360.0, 360.0);
//Set the rotation around the y-axis of both wheels
frontLeftWheel.localEulerAngles = Vector3 (0, steerAngle, 0); // does not cause sinking
frontRightWheel.localEulerAngles = Vector3 (-lastTireRotationAngle, steerAngle, 0); // causes sinking
Any ideas of what is going on and how to correct it?