Skip to main content
gamedev.net
🔒 Locked

Collision Behaviour Question?

Started by NotTaxes May 28, 2002 at 3:17 AM 1 replies 150+ views
Original Post
NotTaxes
NotTaxes
I''ve finally got my collision detection routines working great using multi-pass detection that starts with bounding boxes and ends with tri-tri. The detection routine is running pretty fast, and it can give me a good degree of accuracy as to which part of model hit a particular object. My problem now is trying to figure out what should happen after a collision has occured. The character should stop moving if it walks into an object, but it should also be able to walk on top of objects. The thing is, in 3D there always collisions on at least two axis. Walking into a wall will generate a collision in the y-axis(because I''m at the right height), but also in the x-axis because I am moving into the object. Walking on top of a wall would generate exactly the same collision scenario (assuming that gravit is pulling the character down, being on top of the wall would always result in a y-axis collision, and because the character is ''over'' the wall, I would collisions on the z/x axis). I can''t just use the delta of the character''s movement because falling down and bumping into a wall appears exactly the same as walking on top of it (there is a delta-x and a delta-y component in both cases). Does anyone have any idea how I can determine what the correct behaviour should be?
'Doing the impossible is kind of fun' - Walt Disney
NotTaxes
NotTaxes
OK, how does this sound to you?

I first check the vertical collision depth, and if it is <= 10% of the model''s height, I assume that it should be ontop of the object, move the character to the top of the object and ignore any further detection. However, if the depth is > 10% then I leave the vertical movement alone and do an X/Z detection.

Does that sound about right? I could play with the 10% factor to cater for movement speeds (so that if the penetration depth < object''s move speed then assume it''s on-top)< but otherwise the logic remains the same.
'Doing the impossible is kind of fun' - Walt Disney
NotTaxes
NotTaxes
And that would also be quite a useful solution for stair-climbing and lifts, so long as the lift doesn''t move upwards faster than gravity.
'Doing the impossible is kind of fun' - Walt Disney

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.