ScriptReference/Physics.CapsuleCast #316
Replies: 1 comment 1 reply
-
|
And provided tweaked code that solved that issue and attempted to take scaling into account. Transform transform = characterController.transform;
Vector3 scale = transform.lossyScale;
float radiusScale = Mathf.Max(Mathf.Abs(scale.x), Mathf.Abs(scale.z));
Radius = characterController.radius * radiusScale;
float offset = Mathf.Max(characterController.height * 0.5f * Mathf.Abs(scale.y), Radius) - Radius;
Vector3 center = transform.TransformPoint(characterController.center);
SpherePosition1 = new Vector3(center.x, center.y - offset, center.z);
SpherePosition2 = new Vector3(center.x, center.y + offset, center.z);
// Output: Radius, SpherePosition1, SpherePosition2 |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
ScriptReference/Physics.CapsuleCast
https://docs.unity3d.com/ScriptReference/Physics.CapsuleCast.html
Beta Was this translation helpful? Give feedback.
All reactions