Hi everyone,
I’m trying to see where the center of mass is located on my rigidbody, is there a way to draw it on the screen so I can then position it accordingly?
Thanks in advance!
Hi everyone,
I’m trying to see where the center of mass is located on my rigidbody, is there a way to draw it on the screen so I can then position it accordingly?
Thanks in advance!
using UnityEditor; using UnityEngine; [CustomEditor(typeof(Rigidbody))] public class RigidbodyEditor : Editor { void OnSceneGUI() { Rigidbody rb = target as Rigidbody; Handles.color = Color.red; Handles.SphereCap(1, rb.transform.TransformPoint(rb.centerOfMass), rb.rotation, 1f); } public override void OnInspectorGUI() { GUI.skin = EditorGUIUtility.GetBuiltinSkin(UnityEditor.EditorSkin.Inspector); DrawDefaultInspector(); } }