Terrain collision

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

Recommended Posts

Im looking for a way to handle collision on a non-flat surface with a moving object (well say a ball). I know there is a collision if a.(x-p) = 0, but there is a vector of motion for a given plane. So once the ball hits, I want to find which way it's velocity starts to change. o . .. ... ball should move towards slope of plane(right down in this case). I need this to work for any arbitrary 3d plane though.

Share on other sites
The force of the impact is applied along the normal of the collision (vector difference between the collision points). For a sphere and a plane, it is just the normal of the plane.

Not quite sure what you mean by toward the slope of the plane, do you mean the sphere will slide down the plane or does it bounce off?

Share on other sites
I dont mean bouncing off of the terrain but say you jumped down a huge hill, you would hit the hill and then roll along the changing slope of the terrain? Like a skateoarder in ramp.

Share on other sites
Once you have the collision normal:
- to bounce the falling object: object.Velocity -= 2 * normal * Vector.DotProduct(normal, object.Velocity)
- to 'slide' the object along the plane: object.Velocity -= normal * Vector.DotProduct(normal, object.Velocity)

1. 1
2. 2
3. 3
Rutin
15
4. 4
khawk
14
5. 5
frob
12

• 9
• 11
• 11
• 23
• 12
• Forum Statistics

• Total Topics
633661
• Total Posts
3013226
×