Jump to content
  • Advertisement
Sign in to follow this  
svetpet

Oriented rectangles problem

This topic is 813 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

Hello, I am working on game, where we use circles as collision bodies. They are fine, but for some objects they are not very useful (for instance 2x6 meters object). Circles are nice, because as the objects are moving towards waypoint and colliding between each other, they slide by the colliding object and continue to the waypoint.

 

So I started using oriented rectangles as collision bodies, which is a lot more realistic than the circles, but now the objects can stuck behind each other and stay there forever, which is not desirable.

 

As far as I know I can solve this problem by:

- implement dynamic pathfinding - this will be the best solution, but more challenging

- if unit is stuck behind another, it can slide to left or right (which is kind of a hack in my opinion)

- use capsules, instead of rectangles, but I am not sure if I will have the desired effect

 

Do you have any suggestions?

Share this post


Link to post
Share on other sites
Advertisement

You say moving left or right is a hack solution, well actually to me using circles to circumvent the need for better pathfinding is even more of a hack than implementing left/right when they get stuck. Also, if the hack works for your game then it's not always a bad thing. So I'd recommend trying the next simplest solution, see how it goes, and then figure out what next to do.

Share this post


Link to post
Share on other sites

Use capsules for non-uniform objects and try to push the problem to the physics engine first.  

 

OBBs fit well on objects but sometimes they can decrease the performance of the collision pipeline of the physics engine you're using. They are usefull for static geometry though.

 

Since you mentioned "units" I suspect this is related to NPCs or so. I recommend using capsules as collision shapes both for the players as well as the NPCs and implement some simple path-finding algorithm for the NPCs.

 

Sorry, I can't recommend a good algorithm. I implemented A* and mixed navigation meshes some years ago but don't know if it is included in the state of the art package of game AI today. Probably you should take a look in the AI section or start another thread there.  

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!