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. Join us on Thursday, June 8, for a Q&A with Unity's Content Pipeline group here on the forum, and on the Unity Discord, and discuss topics around Content Build, Import Workflows, Asset Database, and Addressables!
    Dismiss Notice

Question Changing center of gravity of a gameObject

Discussion in '2D' started by ei-india, Mar 20, 2023.

  1. ei-india


    Dec 16, 2022
    How do I change the center of gravity of a 2d gameObject(using a sprite renderer). Basically what I want to do is make the object rotate around a different pivot point when specified. Any help appreciated.
  2. Kurt-Dekker


    Mar 16, 2013
    Some possibilities:

    You can change the pivot in the sprite editor.

    You can offset it with a hierarchy of GameObjects (offsetting the children)

    You could compute the offsets yourself and apply them.

    Since you said "center of gravity," if you are ACTUALLY talking about Rigidbody2D physics then there is a property to set the center of mass... go check the docs for Rigidbody2D.
    MelvMay likes this.