AStar Pathfinding integration + backward movement

Hello,

I was trying to introduce backward movement with usage of Pathfinding project. When I created a custom AIPath, my character was stuck in place. It turned out it was due to the following code part in UCC (attached also as print screen):

if (UsingVerticalCollisionDetection && UsingHorizontalCollisionDetection && localDesiredMovement.y > 0) {
for (int i = 0; i < m_ColliderCount; ++i) {
var activeCollider = m_Colliders;
if (!activeCollider.gameObject.activeInHierarchy) {
continue;
}
hitCount = OverlapColliders(activeCollider, activeCollider.transform.position + m_DesiredMovement + m_Up * c_ColliderSpacing, activeCollider.transform.rotation, -m_SkinWidth * 2);
if (hitCount > 0) {
m_DesiredMovement = Vector3.zero;
break;
}
}
}
I can confirm my m_DesiredMovement was a Vector3 with y = 0. But the vector localDesiredMovement calculated with MathUtility.InverseTransformDirection method turned out to have a small positive y value.
 

Attachments

  • Untitled.png
    Untitled.png
    37 KB · Views: 2
That code will only run when there is an object collision. What is colliding with your character at that point?
 
Back
Top