Archived

This topic is now archived and is closed to further replies.

Jumpy collisoin

This topic is 5011 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

An easy solution is interpolation. To the old ( last frame ) position, add:

(the delta of the new ( current frame ) position and the old position) divided by some constant.

For example. Let''s say we are smoothing only the y values. We had a position of 12, 8, 10 last frame. This frame we are at 13, 11, 10. This would create a massive jump. So instead of hopping directly to 11 we:

8 += ( 11 - 8 ) / 10;
New height = 8.3

If we don''t move then next frame our height would be:

8.3 += ( 11 - 8.3 ) / 10;
New height = 8.57

Until we eventually converged near the new height of 11. Obviously then the higher the smoothing constant, the "smoother" the transition is. This also has the obvious effect of maintaining a bit of jump when the deltas are very large ( as you would want ).

Share this post


Link to post
Share on other sites
cheers for the replys...

my collision object is a sphere, and my collision method is bounding sphere.
What i am doing so far is calling my checkCollision() method which returns a list of polygons that were hit. Then, if we have a collision, i project the camera sphere centre onto the colliding polygons plane, then i push the spheres centre back in the direction of the polygons normal + the radius of the sphere.

When i run the camera along the floor, it ''bounces'' and i can''t seem to stop it

Share this post


Link to post
Share on other sites
...which is preditable. You can catch an edge on the floor, and the sphere can bounce back, depending on the order of collisions, which is completely random if you don;t use a swept test.

I did a collision detection demo, using almost the same principle. Only, when the sphere''s new position is calculated, I process collisions using the new position, then push that position about. So, it''s constraining the next sphere position to the polygons. At the end of the collision check, the new position should guarantee a place where the sphere would not intersect polygons. Then I move the sphere to that position. It gives satisfying results, but it''s not perfect. Although, it''s simple and works pretty well.

for best results, a swept test is the best, but it''s more complicated.

Sphere - triangle collision demo

Share this post


Link to post
Share on other sites