/// <summary>Returns the center of the currently edited collider (for 2D colliders only x and y values are filled.</summary> /// <param name="ba">A reference to the main instance of the BlenderActions class to take data from</param> public static Vector3 GetEditableColliderCenterLocalSpace(BlenderActions ba) { Vector3 result = Vector3.zero; if (ba.EditedBoxCollider != null) { result = ba.EditedBoxCollider.center; } else if (ba.EditedSphereCollider != null) { result = ba.EditedSphereCollider.center; } else if (ba.EditedCapsuleCollider != null) { result = ba.EditedCapsuleCollider.center; } #if U2017 else if (ba.EditedBoxCollider2D != null) { result = ba.EditedBoxCollider2D.offset; } else if (ba.EditedCapsuleCollider2D != null) { result = ba.EditedCapsuleCollider2D.offset; } else if (ba.EditedPolygonCollider2D != null) { result = ba.EditedPolygonCollider2D.offset; } else if (ba.EditedCircleCollider2D != null) { result = ba.EditedCircleCollider2D.offset; } else if (ba.EditedEdgeCollider2D != null) { result = ba.EditedEdgeCollider2D.offset; } else if (ba.EditedWheelCollider != null) { result = ba.EditedWheelCollider.center; } #endif return(result); }
/// <summary>Sets the center of the currently edited collider.</summary> /// <param name="newCenter">A vector to use as the new center of the edited collider</param> /// <param name="ba">A reference to the main instance of the BlenderActions class to take data from</param> public static void SetEditableColliderCenterLocalSpace(Vector3 newCenter, BlenderActions ba) { Vector2 newCenter2D = new Vector2(newCenter.x, newCenter.y); if (ba.EditedBoxCollider != null) { ba.EditedBoxCollider.center = newCenter; } else if (ba.EditedSphereCollider != null) { ba.EditedSphereCollider.center = newCenter; } else if (ba.EditedCapsuleCollider != null) { ba.EditedCapsuleCollider.center = newCenter; } #if U2017 else if (ba.EditedBoxCollider2D != null) { ba.EditedBoxCollider2D.offset = newCenter2D; } else if (ba.EditedCapsuleCollider2D != null) { ba.EditedCapsuleCollider2D.offset = newCenter2D; } else if (ba.EditedPolygonCollider2D != null) { ba.EditedPolygonCollider2D.offset = newCenter2D; } else if (ba.EditedCircleCollider2D != null) { ba.EditedCircleCollider2D.offset = newCenter2D; } else if (ba.EditedEdgeCollider2D != null) { ba.EditedEdgeCollider2D.offset = newCenter2D; } else if (ba.EditedWheelCollider != null) { ba.EditedWheelCollider.center = newCenter; } #endif }
//#colreg(green); #region Collider misc utils /// <summary>Adds a vector to the existing position of the edited collider center.</summary> /// <param name="moveTo">A vector to add to the collider's center</param> /// <param name="ba">A reference to the main instance of the BlenderActions class to take data from</param> public static void MoveEditableColliderCenterLocalSpace(Vector3 moveTo, BlenderActions ba) { Vector2 moveTo2D = new Vector2(moveTo.x, moveTo.y); if (ba.EditedBoxCollider != null) { ba.EditedBoxCollider.center += moveTo; } else if (ba.EditedSphereCollider != null) { ba.EditedSphereCollider.center += moveTo; } else if (ba.EditedCapsuleCollider != null) { ba.EditedCapsuleCollider.center += moveTo; } #if U2017 else if (ba.EditedBoxCollider2D != null) { ba.EditedBoxCollider2D.offset += moveTo2D; } else if (ba.EditedCapsuleCollider2D != null) { ba.EditedCapsuleCollider2D.offset += moveTo2D; } else if (ba.EditedPolygonCollider2D != null) { ba.EditedPolygonCollider2D.offset += moveTo2D; } else if (ba.EditedCircleCollider2D != null) { ba.EditedCircleCollider2D.offset += moveTo2D; } else if (ba.EditedEdgeCollider2D != null) { ba.EditedEdgeCollider2D.offset += moveTo2D; } else if (ba.EditedWheelCollider != null) { ba.EditedWheelCollider.center += moveTo; } #endif }
public Rotate(BlenderActions blenderActions) : base(blenderActions) { }
public NumericInput(BlenderActions ba) { BA = ba; }
public Translate(BlenderActions blenderActions) : base(blenderActions) { }
public Scale(BlenderActions blenderActions) : base(blenderActions) { }
public BaseTransform(BlenderActions blenderActions) { BA = blenderActions; }