Hey guys,
I’ve a kind of complicated setup within the FauxGravity script ( for a planetary gravity) and a rigidbody character that is standing one a wheel collider - for the right orientation in this planetary scenario I need a script what transmits only the Y and Z rotation of a certain gameobject to my character. The X axis has to be free, because of steering the character (with MoveRotaion). I tried to arrvied that by using a configuralbe joint, but when I use a CJ the wheel collider acting very strange (brake doesn’t work).
Than I tried this one:
var TargetRotation : Transform;
private var YRotation : float;
private var ZRotation : float;
function Update()
{
YRotation = TargetRotation.transform.eulerAngles.y;;
transform.eulerAngles.y = YRotation;
ZRotation = TargetRotation.transform.eulerAngles.z;
transform.eulerAngles.z = ZRotation;
}
By using this script the character spins around.
Is there a way to achieve to rotation transmission by using MoveRotation? Or do someone else have an Idea?( Maybe there is a possibility to merge the orientation and the steering into a Quaternion??)
Hopefully someone understand what I try to explain.