protected override void CopyColliderPropertiesToHandle() { CapsuleCollider capsuleCollider = (CapsuleCollider)base.target; this.m_BoundsHandle.center = base.TransformColliderCenterToHandleSpace(capsuleCollider.transform, capsuleCollider.center); float num; Vector3 capsuleColliderHandleScale = this.GetCapsuleColliderHandleScale(capsuleCollider.transform.lossyScale, capsuleCollider.direction, out num); CapsuleBoundsHandle arg_5D_0 = this.m_BoundsHandle; float num2 = 0f; this.m_BoundsHandle.radius = num2; arg_5D_0.height = num2; this.m_BoundsHandle.height = capsuleCollider.height * Mathf.Abs(capsuleColliderHandleScale[capsuleCollider.direction]); this.m_BoundsHandle.radius = capsuleCollider.radius * num; int direction = capsuleCollider.direction; if (direction != 0) { if (direction != 1) { if (direction == 2) { this.m_BoundsHandle.heightAxis = CapsuleBoundsHandle.HeightAxis.Z; } } else { this.m_BoundsHandle.heightAxis = CapsuleBoundsHandle.HeightAxis.Y; } } else { this.m_BoundsHandle.heightAxis = CapsuleBoundsHandle.HeightAxis.X; } }
private void CopyColliderSizeToHandle() { Vector3 vec; Vector3 vec2; GetHandleVectorsInWorldSpace(out vec, out vec2); CapsuleBoundsHandle boundsHandle = m_BoundsHandle; float num = 0f; m_BoundsHandle.radius = num; boundsHandle.height = num; m_BoundsHandle.height = vec.magnitude; m_BoundsHandle.radius = vec2.magnitude * 0.5f; }
protected override void CopyColliderSizeToHandle() { CapsuleCollider2D collider = (CapsuleCollider2D)base.target; Vector3 vector; Vector3 vector2; this.GetHandleVectorsInWorldSpace(collider, out vector, out vector2); CapsuleBoundsHandle arg_31_0 = this.m_BoundsHandle; float num = 0f; this.m_BoundsHandle.radius = num; arg_31_0.height = num; this.m_BoundsHandle.height = vector.magnitude; this.m_BoundsHandle.radius = vector2.magnitude * 0.5f; }
public override void OnSceneGUI() { if (!action.debug.Value) { return; } var color = Handles.color; Handles.color = action.debugColor.Value; EditorGUI.BeginChangeCheck(); action.InitShapeCenter(); var transform = action.cachedTransform; var newCenter = Handles.PositionHandle(action.center, transform != null ? transform.rotation : Quaternion.identity); Handles.matrix = Matrix4x4.TRS(action.center, transform != null ? transform.rotation : Quaternion.identity, Vector3.one); switch (action.shape) { case FindOverlaps.Shape.Box: if (boxBoundsHandle == null) { boxBoundsHandle = new BoxBoundsHandle(); } boxBoundsHandle.center = Vector3.zero; boxBoundsHandle.size = action.box.Value; EditorGUI.BeginChangeCheck(); boxBoundsHandle.DrawHandle(); if (EditorGUI.EndChangeCheck()) { action.box.Value = boxBoundsHandle.size; } break; case FindOverlaps.Shape.Sphere: action.radius.Value = Handles.RadiusHandle(Quaternion.identity, Vector3.zero, action.radius.Value); break; case FindOverlaps.Shape.Capsule: if (capsuleBoundsHandle == null) { capsuleBoundsHandle = new CapsuleBoundsHandle(); } capsuleBoundsHandle.center = Vector3.zero; capsuleBoundsHandle.height = action.height.Value; capsuleBoundsHandle.radius = action.radius.Value; capsuleBoundsHandle.heightAxis = CapsuleBoundsHandle.HeightAxis.Y; EditorGUI.BeginChangeCheck(); capsuleBoundsHandle.DrawHandle(); if (EditorGUI.EndChangeCheck()) { action.radius.Value = capsuleBoundsHandle.radius; action.height.Value = capsuleBoundsHandle.height; } break; } Handles.color = color; if (EditorGUI.EndChangeCheck()) { action.offset.Value = transform == null ? newCenter : transform.InverseTransformPoint(newCenter); GUI.changed = true; } }