A* Pathfinding Project

Manually controlling AI rotation


#1

Hi guys, I have an issue with toggling off rotation on the RichAI component. I am using A* pathfinding pro in conjunction with UFPS and the behavior designer A* integration. At the same time as I toggle off RichAI rotation, I also set UFPS UltimateCharacterLocomotion ManualMove to true. While rotation is disabled and ManualMove is true I manually rotate the AI to face a certain direction. This works fine and looks good. The problem comes when I disable ManualMove and re-enable RichAI pathfinding. The AI will immediately rotate to the rotation it last had when it was following its calculated path. I’m not entirely sure whether this is being caused by A* pathfinding or UFPS. Hope someone has a suggestion for what I could try!

As for the context for why I need to control rotation manually is for AI patrolling (like Metal Gear Solid) where an AI would reach a waypoint, rotate to face a particular direction, wait a period of time and then continue on to the next waypoint.


#2

Hi

I’m assuming you are using ai.updateRotation for this.

I would recommend you then to not enable ai.updateRotation, instead you can use your own code to rotate the character in the direction you want. You can use ai.rotation as a source for this information. That rotation will be the rotation that the ai wants to have.


#3

Hi

Thanks for replying to quickly. I’m using ai.enableRotation but I guess its very similar. Ah I see, that’s very useful being able to read out the desired rotation from the RichAI. I will try keeping rotation disabled for patrolling and report back


#4

Not quite.
I really should make that an enum though…

When updateRotation = false the ai will still rotate towards its destination and everything. However it will only update the ai.rotation property, it will not rotate the Transform itself.


#5

I did figure this out in the end. Turned out i did need to use enableRotation and had to keep updateRotation on to make sure rotation was kept synced with the transform rotation. This is because the integration with behavior designer relied on nextRotation being calculated. So all i need to do was disable enableRotation and enable UltimateCharacterLocomotion ManualMove. I was then able to rotate the AI freely. On re-enabling rotation the AI would smoothly continue with the manual rotation since updateRotation was kept enabled. Thanks for getting me on the right track tho!