Sign in to follow this  
bla bla

collision detection and staying on the ground

Recommended Posts

is there a difference between collision detection (walls and obstacles) and making the character/player stay on the ground. in other words could the same algorithms solve both? and is it practical(or is it better to seperate them?) .

Share this post


Link to post
Share on other sites
It depends. If we are talking about outside terrain, then clearly, if such terrain is represented by some sort of height map or even parameteric surface, then there may be faster ways to stay on the ground (depending on the precision required).

As for indoors, my guess is that unless the ground is treated
specially (such as a game where there is only one floor)
there is no need to treat the ground collision specially.

Share this post


Link to post
Share on other sites
Stairs tend to be special cased for "walk around" models. I don't know about heightfield type collisions, but it would make sense that the response code is the same, atleast.

-Morten-

Share this post


Link to post
Share on other sites
it depends on the game... but if there is a lot of jumping and falling and such, it would probably be best to implement gravity (whether realistic or not), and let normal collision detection with the ground keep the player where he should be.

Share this post


Link to post
Share on other sites
If by staying on the ground, you mean it 'blocks', then you can separate the two and its actually better this way.

For example, on the Unreal engine, there is collision and there is blocking. Blocking stops anything from going past but collision calls a function (a trigger) with arguments of who collided with who.

Share this post


Link to post
Share on other sites
I would implement gravity and then just make collision detection/response against the ground each cycle.

Hitting an object like a wall would be the same as hitting the ground, just your response (like sliding) will be against the wall instead of the ground.

Share this post


Link to post
Share on other sites
ok, thanks guys.
I see that most of the opinions tend to include the "staying on ground" in the collision detection. so I will try to make a collision detection that takes in consideration both.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this