detecting 2d environment collisions (floor)

Started by
1 comment, last by nick5454 13 years, 10 months ago
I have a side scrolling super mario type game i'm making. ( super mario on nintendo )

So what is the best way to determine if he lands on the floor? I have the world depicted in tiles so I could test whether he's on top of a tile.

Do people use a ray trace technique with polygons or simply division tests to see if he's directly below a floor tile?

by the way the background is 2d and the player/monsters/bullets are 3d. I realize the actual collisions of the monsters/bullets/players will use ray tracing, but what about environment to player when they fall down or jump.
Advertisement
Like I always say, when the goin' gets rough whip out the math =)

If your terrain is always going to be simple, you could use axis-aligned bounding box (AABB) testing. That might work nicely for all your various right-angle ceiling, floor and wall collisions.

For advanced/sloped terrains, you could go with Oriented bounding boxes (OBBs), but you should also take a look at Point --> Segment collision detection.
--- "A penny saved never boils."
hey thanks a lot!

This topic is closed to new replies.

Advertisement