public ColliderData(string boneName, float colliderRadius, float collierHeight, Vector3 colliderCenter, DynamicBoneCollider.Direction colliderDirection = default, string colliderNamePostfix = "") { BoneName = boneName; ColliderRadius = colliderRadius; CollierHeight = collierHeight; ColliderCenter = colliderCenter; ColliderDirection = colliderDirection; ColliderNamePostfix = colliderNamePostfix; }
public DynamicBoneColliderData(string parent_name, DynamicBoneCollider.Direction direction, Vector3 Center, DynamicBoneCollider.Bound bound, float radius, float heaight) { m_parent_name = parent_name; m_Direction = direction; m_Center = Center; m_Bound = bound; m_Radius = radius; m_Height = heaight; }
// Token: 0x0600271F RID: 10015 RVA: 0x000C0EA8 File Offset: 0x000BF2A8 public void Collide(ref Vector3 particlePosition, float particleRadius) { float num = this.m_Radius * Mathf.Abs(base.transform.lossyScale.x); float num2 = this.m_Height * 0.5f - this.m_Radius; if (num2 <= 0f) { if (this.m_Bound == DynamicBoneCollider.Bound.Outside) { DynamicBoneCollider.OutsideSphere(ref particlePosition, particleRadius, base.transform.TransformPoint(this.m_Center), num); } else { DynamicBoneCollider.InsideSphere(ref particlePosition, particleRadius, base.transform.TransformPoint(this.m_Center), num); } } else { Vector3 center = this.m_Center; Vector3 center2 = this.m_Center; DynamicBoneCollider.Direction direction = this.m_Direction; if (direction != DynamicBoneCollider.Direction.X) { if (direction != DynamicBoneCollider.Direction.Y) { if (direction == DynamicBoneCollider.Direction.Z) { center.z -= num2; center2.z += num2; } } else { center.y -= num2; center2.y += num2; } } else { center.x -= num2; center2.x += num2; } if (this.m_Bound == DynamicBoneCollider.Bound.Outside) { DynamicBoneCollider.OutsideCapsule(ref particlePosition, particleRadius, base.transform.TransformPoint(center), base.transform.TransformPoint(center2), num); } else { DynamicBoneCollider.InsideCapsule(ref particlePosition, particleRadius, base.transform.TransformPoint(center), base.transform.TransformPoint(center2), num); } } }
// Token: 0x06002724 RID: 10020 RVA: 0x000C1344 File Offset: 0x000BF744 private void OnDrawGizmosSelected() { if (!base.enabled) { return; } if (this.m_Bound == DynamicBoneCollider.Bound.Outside) { Gizmos.color = Color.yellow; } else { Gizmos.color = Color.magenta; } float radius = this.m_Radius * Mathf.Abs(base.transform.lossyScale.x); float num = this.m_Height * 0.5f - this.m_Radius; if (num <= 0f) { Gizmos.DrawWireSphere(base.transform.TransformPoint(this.m_Center), radius); } else { Vector3 center = this.m_Center; Vector3 center2 = this.m_Center; DynamicBoneCollider.Direction direction = this.m_Direction; if (direction != DynamicBoneCollider.Direction.X) { if (direction != DynamicBoneCollider.Direction.Y) { if (direction == DynamicBoneCollider.Direction.Z) { center.z -= num; center2.z += num; } } else { center.y -= num; center2.y += num; } } else { center.x -= num; center2.x += num; } Gizmos.DrawWireSphere(base.transform.TransformPoint(center), radius); Gizmos.DrawWireSphere(base.transform.TransformPoint(center2), radius); } }
internal static float ComputeHeightScale(Transform transform, DynamicBoneCollider.Direction direction) { if (direction == DynamicBoneCollider.Direction.X) { return(transform.lossyScale.x); } if (direction == DynamicBoneCollider.Direction.Y) { return(transform.lossyScale.y); } return(transform.lossyScale.z); }
internal static float ComputeRadiusScale(Transform transform, DynamicBoneCollider.Direction direction) { if (direction == DynamicBoneCollider.Direction.X) { return((transform.lossyScale.y + transform.lossyScale.z) / 2); } if (direction == DynamicBoneCollider.Direction.Y) { return((transform.lossyScale.x + transform.lossyScale.z) / 2); } return((transform.lossyScale.x + transform.lossyScale.y) / 2); }
private DynamicBoneCollider InitializeCollider(Transform parent, float radius, float length, DynamicBoneCollider.Direction direction = DynamicBoneCollider.Direction.X, float verticalCenter = 0, float horizontalCenter = 0) { if (parent == null) { return(null); } DynamicBoneCollider collider = parent.GetComponent <DynamicBoneCollider>(); if (collider == null) { collider = parent.gameObject.AddComponent(typeof(DynamicBoneCollider)) as DynamicBoneCollider; } collider.m_Direction = direction; collider.m_Center = new Vector3(0, verticalCenter, horizontalCenter); collider.m_Bound = DynamicBoneCollider.Bound.Outside; collider.m_Radius = radius; collider.m_Height = length; return(collider); }
internal static DynamicBoneCollider InitializeCollider(Transform parent, float radius, float length, Vector3 centerOffset, DynamicBoneCollider.Direction direction = DynamicBoneCollider.Direction.X, DynamicBoneCollider.Bound bound = DynamicBoneCollider.Bound.Outside) { if (parent == null) { return(null); } DynamicBoneCollider collider = parent.GetComponent <DynamicBoneCollider>(); if (collider == null) { collider = parent.gameObject.AddComponent(typeof(DynamicBoneCollider)) as DynamicBoneCollider; } collider.m_Direction = direction; collider.m_Center = centerOffset; collider.m_Bound = bound; collider.m_Radius = radius; collider.m_Height = length; return(collider); }
/// <summary> /// Add a collider to the specified bone /// </summary> private DynamicBoneCollider AddCollider(string boneName, string colliderName, float colliderRadius = 0.5f, float collierHeight = 0f, Vector3 colliderCenter = new Vector3(), DynamicBoneCollider.Direction colliderDirection = default) { //Check if the bone exists var bone = ChaControl.transform.FindLoop(boneName); if (bone == null) { return(null); } //Build the collider var colliderObject = new GameObject(colliderName); var collider = colliderObject.AddComponent <DynamicBoneCollider>(); collider.m_Radius = colliderRadius; collider.m_Height = collierHeight; collider.m_Center = colliderCenter; collider.m_Direction = colliderDirection; colliderObject.transform.SetParent(bone.transform, false); return(collider); }
/// <summary> /// Adds a dynamic bone collider to a controller GO (Thanks Anon11) /// </summary> internal static DynamicBoneCollider AddDBCollider(GameObject controllerGameObject, string colliderName, float colliderRadius = 0.06f, float collierHeight = 0.15f, Vector3 colliderCenter = new Vector3(), DynamicBoneCollider.Direction colliderDirection = DynamicBoneColliderBase.Direction.Z) { var renderModelTf = GetColliderPosition(controllerGameObject); if (renderModelTf == null) { return(null); } //Build the dynamic bone collider var colliderObject = new GameObject(colliderName); var collider = colliderObject.AddComponent <DynamicBoneCollider>(); collider.m_Radius = colliderRadius; collider.m_Height = collierHeight; collider.m_Center = colliderCenter; collider.m_Direction = colliderDirection; colliderObject.transform.SetParent(renderModelTf, false); //Move the collider more into the hand for the index controller // var localPos = renderModelTf.up * -0.09f + renderModelTf.forward * -0.075f; // var localPos = renderModelTf.forward * -0.075f; // colliderObject.transform.localPosition = localPos; // VRLog.Info($"Added DB Collider to {controllerGameObject.name}"); return(collider); }
internal static DynamicBoneCollider AddDBCollider(GameObject controllerGameObject, string colliderName, float colliderRadius = 0.05f, float collierHeight = 0f, Vector3 colliderCenter = new Vector3(), DynamicBoneCollider.Direction colliderDirection = default) { //Build the dynamic bone collider GameObject colliderObject = new GameObject(colliderName); DynamicBoneCollider collider = colliderObject.AddComponent <DynamicBoneCollider>(); collider.m_Radius = colliderRadius; collider.m_Height = collierHeight; collider.m_Center = colliderCenter; collider.m_Direction = colliderDirection; colliderObject.transform.SetParent(controllerGameObject.transform, false); return(collider); }