Page 1 of 1
Sliding Sprite Collisions
Posted: Mon Apr 03, 2006 5:22 pm
by Cammar
I'm trying to setup simple bounding box collisions with 4 directional movement. I have a sprite with a bounding box on it, the sprite moves around the screen in 4 directions. I want to setup a series of box's on the screen that the sprite bounding box can collide against. That part is easy enough, but I want the sprite to slide against the edge of the box its colliding with. So if the sprite collides with the box from the side I want the sprite to still be able to move vertically. Any one have any psuedo/code to share?
Thanks
Posted: Mon Apr 03, 2006 10:09 pm
by dagcrack
First, if this is 2D then theres no boxes but squares.
So, really, doing a calculation in one more dimension that you need, is not very wise
The sliding is part of the collision response and not the detection. I recommend you to read about collision response and start your own sliding response, if you get stucked then post the problem and we'll join forces to help you solve it.
I believe its better if you understand the entire process before!.
If you find it too hard, I will post an example of custom 2D collision with sliding response, if it makes anyone happy that is. But you should try first.
Posted: Mon Apr 03, 2006 11:42 pm
by Cammar
When I said box I meant a 2D box/square

(Not used to 3D terminology). Time for a google crawl for rigid body physics and that glorious stuff!
Posted: Tue Apr 04, 2006 1:18 am
by dagcrack

I think a box is not the same as a square... I know what you meant but It's just that it's wrong. For example when people saids "I need a couple of ..." Well a couple means 2 but they'll grab more than 2, They refer as a "bunch" but the world COUPLE means 2... Same thing in this case almost, box, square.. none are the same.
And yes, "google will provide"
Posted: Thu Apr 06, 2006 2:46 pm
by Cammar
Aha Success! Simple enough really no need for real physics in my situation at least. Thanks Captain "dagcrack" Pedantic anyway for the offer
