How to move Body to mouse click with constant speed and stop

Discuss issues specific the Java port of Box2D
danielsega
Posts: 1
Joined: Tue Jul 26, 2016 11:11 pm

How to move Body to mouse click with constant speed and stop

Postby danielsega » Tue Aug 16, 2016 2:20 pm

Hey guys, right now I have my player body that is contained within 4 boxes so the player won't go out of bounds. Now what I want to do is to my body to go to the mouse click coordinates with some constant speed and stop once he reaches the destination. I somewhat can do that with translate but the problems starts once it collides with those boxes preventing him to go out of bounds. If I click long enough it can go through them with translate, or sometimes it tends to move a bit once it collides with those wall boundaries and I have the player with high friction to prevent that but still happens. Is there any better solutions for this?

Return to “Java”



Who is online

Users browsing this forum: Bing [Bot] and 2 guests