Search Unity

Rotating a character whose model center is at their feet.

Discussion in 'Scripting' started by rjdfhorn2006, Jun 4, 2016.

  1. rjdfhorn2006

    rjdfhorn2006

    Joined:
    Jun 14, 2010
    Posts:
    141
    I've noticed that most 3d character models have their center/origin at their feet whilst in a t-pose. I currently have a character like this. However, how would you go about making that character rotate around it's actual center (stomach area) in game? Since my character's origin is at their feet, they rotate around it - I'm currently working on a swimming section of my game and would like the character to rotate around their stomach area.

    I know you can parent the character to an empty game object placed around the stomach area and rotate the empty game object instead, but my character moves using rigidbody physics i.e. rotating would be fine, but the character would move away from the empty game object parent node when swimming around.

    Any ideas on how to accomplish this? Is my only choice to move the origin of the character?
     
  2. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    38,727
    Put the rigidbody on the root object, then offset the player's body as a child as you suggested above.

    Assuming you also offset colliders to match geometry (if you care about colliders), then you should get what you want.
     
  3. rjdfhorn2006

    rjdfhorn2006

    Joined:
    Jun 14, 2010
    Posts:
    141