Jump to content
  • Advertisement
Sign in to follow this  

Sphere Parabola Collision

This topic is 2835 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

I've been working my way through learning collision detection and I'm trying to make a little demo where I drop a sphere onto a parabola and have it roll back forth. However, I keep getting the sphere to fall slightly through the parabola as well as having if jump around a bit. Right now I'm ignoring the rolling part and only tracking the position. If you have a webGL enable browser you can see what I'm doing here http://dl.dropbox.co...ollingBall.html
drag your mouse to rotate

This is kinda an overview of what I'm doing.

Collision Detection:
Do these steps for all triangles in parabola and store all collisions if collision time is less than updating change in time (In my case my updating time is 15 milliseconds)

1) Is sphere moving parallel to triangle plane
Yes - Check if sphere is currently colliding with triangle
Yes - Return collision point and set time = 0
No - Continue to check 2
No - Continue to check 2

2) Get first point on sphere to contact triangle plane (call it D)
Create ray (call it DP) from D to D + sv*dt (sv = sphere velocity vector, dt = update time)
See if ray DP intersects triangle plane
Yes - Check if intersection point is in triangle
Yes - Return intersection point and time
No - Find closest point in triangle to sphere (call it Q)
Create ray (call it QR) from Q to Q - sv*dt
Check if ray QR intersects sphere
Yes - Return intersection point and time
No - Return no sphere/triangle intersection
No - Check if sphere is currently colliding with triangle
Yes - return intersection point and time = 0
No - return no sphere/triangle intersection

Dealing with collision if they are detected:

Propagate sphere to first collision time
For all collisions at this time:
If sphere is overlapping triangle, move sphere back so that it is resting on triangle (this is most likely the cause of the jumping, but I have no better idea of what to do)
Zero sphere velocity in normal direction of plane (I know this physically removes energy, so the ball will slow and eventually stop)

If there are more collision points call collision detection function again with new velocity and remainder of dt

So is this the correct way of detecting dealing with these types of collisions? ( I don't care about rolling, friction, and bouncing for now)
Why does the ball still fall through? I think the step where I move the sphere back if it is overlapping the triangle may be a bad idea, but I have no other ideas. And it is most likely the culprit for the jumping.
Are there any holes/gaps in my detection algorithm?

Any help is appreciated and let me know if you want me to explain anything more. Also, I'm pretty good at math so if there are any journal/conference/thesis papers you could direct me to I don't mind reading through the math.

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!