Search Unity

Rotating an gameObject synchronously with another

Discussion in 'Physics' started by PurePwnage, Mar 23, 2017.

  1. PurePwnage

    PurePwnage

    Joined:
    Feb 20, 2017
    Posts:
    2
    Hi everyone,

    I have two gameObjects: a wheel and something like a table. When the player turns the wheel, the table should turn exactly the same amount. Currently I use the following code:

    Code (CSharp):
    1. private void Update()
    2.         {
    3.             table.transform.rotation = Quaternion.Euler(0, this.transform.rotation.eulerAngles.z, 0);
    4.         }
    Unfortunately this does not rotate the table(eith physics), but it only changes its rotation. Objects placed on the table only change their rotation and position if they are children of the table.

    What is the correct way to implement a synchronous rotation?

    Thank you!