Support Forum

Set desired rotation on destination reached?

I’m using RichAI and MecanimBridge.

Currently I have my character rotate to face a desired direction after it reaches its destination. However it looks weird, since the character stops at the destination, then rotates in place.

Is there some way to set a desired destination rotation, so the character arrives at the destination facing that rotation?

Hi

With the current movement scripts this is unfortunately not possible :confused:
The scripts would have to be modified for that to work.

@aron_granberg how would you recommend implementing this with RichAI & MecanimBridge? I’ve extended both a little so there are a couple ways I can think of, but not sure what would be the cleanest approach. Thanks!

Thread necromancy (Sorry).

But has this feature been implemented? Can it be implemented?

If I were to do it myself (Which isnt ideal if im buying a package) how would I do it? etc? Are there algorithms out there which can do this and will be easily plugged-into this system?

If this package cant do it, can anyone recommend one which can? I’m desperately looking for something which supports this one simple feature. And, despite my coding knowledge being quite wide, AI and pathfinding is not something i’ve spent too much time reading up on.

@mrclam I wrote the below as a reply to the notification email, but it looks like it wasn’t posted (this might be a forum bug @aron_granberg). Here is my response, six days late:

No it hasn’t. I ended up doing a standing rotation on destination arrival, but doing rotate as you go wouldn’t be too hard to implement yourself. As the agent is moving to the destination compare the current rotation to the destination rotation, and turn that frame by a small amount based on the remainingDistance value to the target. Where you execute that rotation is dependent on your situation, e.g. root motion vs in place. If it’s the former than MecanimBridge is where you want to do it. If it’s the latter then you can have a script execute the turn when your RichAI or AIPath does it’s locomotion.

I can’t fault the Aron for not including this. His asset is for pathfinding/navigation, not character control. His character control scripts are examples or foundations to build on, but themselves aren’t central to the core purpose of the asset other than to show practically how an agent could use A* to navigate the game world.

I made this thread mainly out of laziness and a hope that Aron had some example that already achieved this, but I don’t think it’s reasonable to expect it.

The main thing I’ve been lazy about is taking the time to read and understand the locomotion (velocity etc) code in AIPath (or RichAI as the case may be, I recently switched to AIPath as I moved from Recast to GridGraph).

And to your last question, I’m familiar with with most of the assets out there on character locomotion and I have never seen one that implements this. I don’t expect Aron to add it, however I do wish he had more heavily commented his locomotion code since I recently had to go through it to estimate arrival times.

Best of luck, and post it here if you end up implementing a solution.