How to involve physics

Hi @aron_granberg

I would like to include physics in my game such as knock backs, pulls, bounciness and so on.

With the current script I am using (AILerp) I cant do this as the player keeps jumping to the next waypoint.

How would you handle this? disable AILerp when physics are triggered?

Thanks.

Hi

I would recommend using another movement script (for example AIPath) that can better handle physics. The AILerp script is intended to follow the path exactly without any deviations, while the AIPath script is intended to follow the path smoothly in a way that may include physics and other things.

Forgot to mention, it is a 2D top down game… I’ll check how AIPath works

Hi

AIPath works for 2D top down games. If you have the pro version you can check out the RVO 2D example scene which includes the AIPath script used in a 2D top-down scenario.

I had a similar problem @aron_granberg . I found that AIPath script rotates 2D object for me when walking on the path. If I deselect 2D rotation the NPC doesn’t move at all. I wanted to add a knockback, I added the knockback using rigidbody2D component and then it kind of snaps back where it last was even though I’m calling search again on the entity on the AILerp behavior. Please let me know what to do in this case and if I need pro version for this. I just need the AIPath to work normally without rotation in 2D top down. Thanks a lot.

After changing AILerp with AIPath, everything works fine.

I can drag the NPC and drop it anywhere and it will walk from where it landed.

I’d say you might be facing a bug

Oh, thanks @Raul_Duarte I think there’s an update available hopefully I’ll upgrade smoothly? I have my graphs cached. I’ll let you know if it worked for me later, thanks again.

Still doesn’t work @Raul_Duarte @aron_granberg . If I don’t tick Rotation in 2D and then disable freeze rotation Z on rigidbody2D it doesn’t even move, and after doing that the object rotates towards the goal automatically. Please kindly let me know how to solve this issue and if that can be done with the free version of the package or not. Thanks