Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Rotating parent does not rotate child collider correctly

Discussion in 'Scripting' started by EvanTune, Jul 29, 2016.

  1. EvanTune

    EvanTune

    Joined:
    Mar 8, 2016
    Posts:
    10
    Hello there, so I have parent gameObject with a box collider, and a child gameObject with a box collider. When I set the eulerAngles of parent in script, the childs collider does not follow, but in scene it shows to do so. The parent and child gameObjects are both rotating, but the childs collider is not. If I turn child collider on and off in inspector with mouse then the collider sets to right position.

    Any idea why? Thanks.
     
    Last edited: Jul 29, 2016
  2. LeftyRighty

    LeftyRighty

    Joined:
    Nov 2, 2012
    Posts:
    5,148
    the child's rotation in the inspector is it's rotation relative to the parent (i.e. "localRotation", not "rotation"). So rotating the parent will do nothing to the child's rotation in the inspector.
     
    EvanTune likes this.