private void RotateTowardsVelocity() { Vector3 velocity = new Vector3(rb.velocity.x, rb.velocity.y, 0); Vector3 angle = SelfRotation.ComputeTotalAngle(velocity, Vector3.right); transform.eulerAngles = angle; }
public override void OnInspectorGUI() { base.OnInspectorGUI(); SelfRotation selfRotation = (SelfRotation)target; GUIContent arrayLabel = new GUIContent("Axises"); selfRotation.AxisIndex = EditorGUILayout.Popup(arrayLabel, selfRotation.AxisIndex, selfRotation.Axises); }