- Home /
Question by
jk15 · May 17, 2018 at 12:59 AM ·
rotationpositionvector3quaternion
Sync Rotations of objects with differing position and rotation
I have 2 gameObjects, each has a different position and rotation to the other.
When I change the rotation of the first gameObject I want the second gameObject to rotate the same, but not relative to its own rotation.
So if the first gameObject's Y axis is pointing up, and I start rotating it around its Y axis, I want to see the same rotation visually on the second gameObject, as if its Y was pointing up also, even if it is not.
I hope that makes some sense!? Thanks.
Comment
Answer by NoDumbQuestion · May 17, 2018 at 09:18 AM
@jk314 A nice and simple solution.
public GameObject go1;
public GameObject go2;
public Vector3 Rotate2Objects
{
set
{
go1.transform.eulerAngles += value;
go2.transform.eulerAngles += value;
}
}