Sign in to follow this  
Raeldor

Terrain Collision Response

Recommended Posts

Raeldor    254
Hi All, I am trying to get to grips with how terrain integrates into a physics engine. Assuming firstly that you have a flat terrain, I understand that the calculation of displacement via velocity is from the sum of forces acting on the object. So, forward momentum+gravity. Would you include the upward force of terrain as one of those forces? That seems to indicate a special exception since you don't really know if the object is 'resting' on the terrain if you are treating the terrain as just another object. It seems more likely you will fall through the terrain and then have to calculate some kind of collision response (deflection). Depending on your momentum, doesn't this result in a bouncing up and down motion as you are constantly being reflected off the terrain? Thanks

Share this post


Link to post
Share on other sites
Guest Anonymous Poster   
Guest Anonymous Poster
Objects don't have to intersect for a detectable collision. The algorithm has to check the terrain and move the object in a way that it only touches the terrain without intersections. The same algorithm can be used for mobile objects to avoid rubberband effects on collisions.

For example, two spheres intersect if the distance between the two centers is smaller than the sum of their radiuses. They touch exactly when the distance equals to the sum. For bounce less movement the collision engine has to keep objects exactly in the touching distance.

Viktor

Share this post


Link to post
Share on other sites
Raeldor    254
Quote:
Original post by Anonymous Poster
Objects don't have to intersect for a detectable collision. The algorithm has to check the terrain and move the object in a way that it only touches the terrain without intersections. The same algorithm can be used for mobile objects to avoid rubberband effects on collisions.

For example, two spheres intersect if the distance between the two centers is smaller than the sum of their radiuses. They touch exactly when the distance equals to the sum. For bounce less movement the collision engine has to keep objects exactly in the touching distance.

Viktor


Thanks for the reply. How does this equate to the laws of conservation of energy? Where does the energy from the downward force of gravity on the object against the terrain go to?

Share this post


Link to post
Share on other sites
Guest Anonymous Poster   
Guest Anonymous Poster
Quote:
Original post by Raeldor
Quote:
Original post by Anonymous Poster
Objects don't have to intersect for a detectable collision. The algorithm has to check the terrain and move the object in a way that it only touches the terrain without intersections. The same algorithm can be used for mobile objects to avoid rubberband effects on collisions.

For example, two spheres intersect if the distance between the two centers is smaller than the sum of their radiuses. They touch exactly when the distance equals to the sum. For bounce less movement the collision engine has to keep objects exactly in the touching distance.

Viktor


Thanks for the reply. How does this equate to the laws of conservation of energy? Where does the energy from the downward force of gravity on the object against the terrain go to?


The force of the gravity that pulls an object down should be equal to the force of the terrain that is 'pushing' the object back. This is why one feels it's own weight on his feet. If this force from the terrain that comes from it's material state (hardness) would be less than the force of gravity one would go into the terrain by pushing it downward and sideways, like it happens with less solid (fluid) materials like water.

Share this post


Link to post
Share on other sites
BinaryStylus    133
I am working with this problem myself. I have tried a couple of approaches - but am mostly concerned with collision detection against the terain. My collision system at the moment uses spheres OBBs planes and rays - and it is hard to include "terrain" (and i suppose I mean heightmaps here) in a solid body collision system.

The best I have come up with is to implement triangles as another element that can interact with the above objects and then do a broad phase collision check with "OBBs / AABBs" of terrain and the narrow phase checks with each triangle in that block of terrain.

As for physics! Just assume that the terrain's mass is infinite! and redo a special case for your impulse algorithms.

---Physics---

A way I have found to get an object to come to "rest" on the ground under constant acceleration (Force) is as follows.

Give your object the velocity it would acheive due to the acceleration at the end of the time frame.
Have an algorithm which tells you the distance/time to impact.
Then work out the velocity due to acceleration at that distance/time.
Then do the physics response using the above velocity - This velocity should be tiny as the object was almost touching before.
Have a THETA value that will alow you to ignore velocities smaller than it.
So if they were almost at rest nothing happens.

Share this post


Link to post
Share on other sites
NotAYakk    876
Quote:
Original post by Raeldor

Thanks for the reply. How does this equate to the laws of conservation of energy? Where does the energy from the downward force of gravity on the object against the terrain go to?


The application of force without movement involves no kinetic energy.

Really. =)

And force in a direction perpendicular to movement ... also involves no kinetic energy.

It is only when the force causes movement over a distance that kinetic energy is involved.

Going up against gravity consumes kinetic energy. Going down with gravity produces kinetic energy. Standing still, pushing against a solid immobile surface, neither produces nor destroys kinetic energy.

The relevent equation:
E = F*D
Energy = Force * Distance
where "*" in this case is the dot-product
alternatively:
Energy = |Force||Distance|sin(angle between the force and the distance travelled)

That help?

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