Hang ability not work with BoxCollider

Kirshor

Member
Hi,
In demo scene, I tested as below: replace MeshCollider of HangLedge Object by BoxCollider. The Hang Ability stop at the line 307:

// Ensure there is space above the hit object.
var raycastNormal = Vector3.ProjectOnPlane(raycastHit.normal, m_CharacterLocomotion.Up).normalized;
var rotation = Quaternion.LookRotation(-raycastNormal, m_CharacterLocomotion.Up);
var startPosition = MathUtility.TransformPoint(raycastHit.point, rotation, Vector3.up * 0.1f) - (raycastNormal * 0.1f);
if (!Physics.Raycast(startPosition, -m_Transform.up, out raycastHit, 0.11f, 1 << hitObject.layer, QueryTriggerInteraction.Ignore)) {
Debug.LogError("Stop here");
return null;
}

What should I do to work with Box Collider. Help me Please.
Thank you very much.
 
Last edited:
My guess is that there is an object above the box collider that is preventing the ability from starting. If you draw the ray that is being cast does it intersect with an object above it?

Code:
            Debug.DrawRay(startPosition, -m_Transform.up);
 
It worked after I increase the "Maximum start offset". I guess that the ray hit MeshCollider at a point lower than the point of the BoxCollider
.Thank you very much.
 
Last edited:
Top