Collision with point and click movement is not working

I have a character that is moving with point and click movement but it can walk through the walls, I had this problem before so my guess it has something to do with force. Does anyone know what line of code i can add so that my character can bounce of the walls? I have tried many things but nothing seems to be working.


The point and click code is not moving the rigid body, it is setting the position of the entity directly. It’s tricky to get a point and click system to with forces/velocity directly as you need to be able to stop the player in exactly the right spot.

The simplest thing you can do here which is not the perfect solution, is to set the velocity of the player to be towards the point you click on and then check if the player is near the spot before you set the velocity to 0.

Thank you for your quick response but im not sure how to do that. I cant find much information about velocity and im quite new to coding in Javascript.