Hi there,
I’m trying to automatically balance out a hovercraft thats driving and jumping over large hills. I’ve setup keys to turn the vehicle around the y axis, and tilt the vehicle forward and back on the x axis. But the vehicle can wildly roll on the z axis, which is undesirable.
I’ve setup the following code so the vehicle automatically correct itself to Zero (as well as a basic print command to tell when its happening). But I’m really just following my nose, as I’m a C# beginner.
if (transform.eulerAngles.z > 10 || transform.eulerAngles.z < -10)
{
transform.eulerAngles = Vector3.Lerp(transform.eulerAngles.z, Vector3.zero, Time.deltaTime);
print ("z" + stoppedCount++);
}
its currently not working and getting the error message “The best overloaded method match for `UnityEngine.Vector3.Lerp(UnityEngine.Vector3, UnityEngine.Vector3, float)’ has some invalid arguments”
Any help, info or direction would be greatly appreciated, as I don’t even know if I’m heading in the right direction.
Thanks dudes!