Jump to content
  • Advertisement
Sign in to follow this  
zgintasz

Solution for character getting stuck on slope corners?

This topic is 874 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi!

I have recorded a short video of what is happening:

https://vid.me/n1XT

as you can see, character sometimes gets stuck while going up the slope. I'm using setLinearVelocity and a straight vector, (-1; 0) for left and (1; 0) for right. Because otherwise, if I use angled velocity, it results in character jumping at the top of the slope. But for down the slope movement, I use angled velocity, works quite well. What should I do?

Share this post


Link to post
Share on other sites
Advertisement
Looks like the character gets stuck because it hits an edge of a box that is (should be) inside a sloped box.
Solution: Use round collision shapes for characters (e.g. square -> circle or charmfered box, box -> capsule...).
This would turn an unwanted edge / edge collision to a smooth vertex / circle collision and should be easy to implement.

Share this post


Link to post
Share on other sites

In general it is silly to use an actual AABB to represent the player collision. Circles, capsules, or other convex shapes (or groups of convex shapes) will work much better and avoid edge catching.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!