private void RecordCylinderCollision ( Vector3 localMoverPosition, Vector3 localNormal, float localMoverRadius, SpringBone.CollisionStatus collisionStatus ) { if (!enabled) { return; } if (colliderDebug == null) { colliderDebug = new SpringColliderDebug(); } var originToContactPoint = radius * localNormal; var localContactPoint = new Vector3(originToContactPoint.x, localMoverPosition.y, originToContactPoint.z); var worldContactPoint = transform.TransformPoint(localContactPoint); var worldNormal = transform.TransformDirection(localNormal).normalized; var worldRadius = transform.TransformDirection(localMoverRadius, 0f, 0f).magnitude; colliderDebug.RecordCollision( worldContactPoint, worldNormal, worldRadius, collisionStatus); }
private void RecordCollision ( Vector3 localMoverPosition, float worldMoverRadius, SpringBone.CollisionStatus collisionStatus ) { if (!enabled) { return; } if (colliderDebug == null) { colliderDebug = new SpringColliderDebug(); } var localNormal = (localMoverPosition).normalized; var localContactPoint = localNormal * radius; var worldNormal = transform.TransformDirection(localNormal).normalized; var worldContactPoint = transform.TransformPoint(localContactPoint); colliderDebug.RecordCollision(worldContactPoint, worldNormal, worldMoverRadius, collisionStatus); }
private void RecordCollision ( Vector3 tailPosition, float tailRadius, SpringBone.CollisionStatus collisionStatus ) { if (!enabled) { return; } if (colliderDebug == null) { colliderDebug = new SpringColliderDebug(); } var planeNormal = GetPlaneNormal(); var planeOrigin = transform.position; var planeToCollision = tailPosition - planeOrigin; var normalProjection = Vector3.Dot(planeToCollision, planeNormal) * planeNormal; var projectedCollisionPoint = tailPosition - normalProjection; colliderDebug.RecordCollision( projectedCollisionPoint, planeNormal, tailRadius, collisionStatus); }