Jump to content
  • Advertisement
Sign in to follow this  
HexDump

Sprites vs lines segments (sprites vs floor collision)

This topic is 2528 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 just implemented a simple quadtree that stores line segments (any angle) as colliders for my world.

I now have to implement a way to use this information to get my collisions done. The way I ussually do the collision detection with a tilemap is fairly easy, just separated the axis movement (first X, then Y) and adjust the sprite postion accordly.

Extending this, my first idea is to separate axis again and do a Line vs Rectangle test for any line segment the sprite is interested (based on the quadtree information) and adjust again position for the player, but it seems a bit of a waste to do this calculations twice (one for the vertical movement and another for the horizontal). On the other hand doing things this way makes restitution pretty easy to calculate.

Could anybody suggest a better aproach to this? Is this first aproximation a performance wise one (I doubt it smile.png)?. Am I perhaps missing something obvious?

Thanks in advance.

Share this post


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

  • Advertisement
×

Important Information

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

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!