I am trying to get the parent object to rotate like the child only in the y axis, I can’t seem to figure it out. The parent is moving forward in the Z axis and the child should control its rotation.
There are no rigidbody’s in the objects and i tried adding and locking in the editor but it didn’t work.
How do I lock it so it only rotates in the y axis?
I have tried Quaternion.LookRotation but I find it is two times too slow and sometimes my camera is facing forward while my object is moving backwards. I need the parent and child to face the same way
I have tried this code but when I rotate the child the parent starts spinning out of control in all the axis’.
void Start () {
theChild = transform.GetChild (0);
theParent = transform;
}
void FixedUpdate () {
theParent.rotation = theChild.rotation;
}
I have also tried this but it doesn’t seem to work at all
theParent.rotation = Quaternion.Euler (newVector3 (0, theChild.rotation.y, 0));
This code is for a google cardboard VR app so the person walks forward the direction they are facing