Created
January 25, 2022 22:50
-
-
Save kurtdekker/d32780c3b1846b21e7b89dcc833a63f6 to your computer and use it in GitHub Desktop.
Sets center of mass on a Rigidbody2D
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
// @kurtdekker | |
// to use, place this on the GameObject where your Rigidbody2D is located | |
public class SetRB2DCenterOfMass : MonoBehaviour | |
{ | |
public Vector3 DesiredCenterOfMass; | |
void Start () | |
{ | |
GetComponent<Rigidbody2D>().centerOfMass = DesiredCenterOfMass; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment