Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice
  3. Dismiss Notice

Question When car turns, how do I add this rotation to turret?

Discussion in 'Physics' started by Yehomere, Jan 5, 2024.

  1. Yehomere


    Dec 26, 2023
    Hi, I'm making a game of a car with a turret on top. The problem is the turret rotates only relative to itself and the world. When the car turns, the turret doesn't rotate with it. This is good for other applications, but how can I have it rotate only relative to the car body? Is there an easy way to do this or would I have to find the change in rotation of the car and add it to the turret rotation?
  2. arkano22


    Sep 20, 2012
    Entirely depends on how you're implemented the turret, which is something you don't mention:
    - Is it a rigidbody, attached to the car via a joint?
    - Is it a regular transform, attached to the car via position constraint?
    - Some other method?