Archived

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

Sphere - polygon collision detection (golf game)

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

Have implemented collision detection in my golf simulation by firing a ray from the ball in the direction of the velocity and testing for intersections with the ground. If an intersection occured and then the next test one doesnt it has hit the ground. Dont no if this is a very good way to do it or not, anyone have any other suggestions? It seems to work ok this way apart from in situation like the following: Here the ball hits the mound in the ground and appears at the other side. Its not because the ray hits multiple objects and gets the position of the otherside because I have ensured that the closest one is always obtained. Does anyone have any suggestions as to why this could be happening or an alternative method to use? If you dont understand what I mean give me your email and I will send a copy of the executable. Thanks Paul [edited by - Paul7 on March 23, 2004 11:00:18 AM]

Share this post


Link to post
Share on other sites
when you get the first intersection, you need to process a collision from that point. Move the ball to the point of collision (minus an offset, to avoid floating point innacuracy problems), change the velocity of the ball, then find another collision with the remaining time and the new velocity. You do that until either, you can''t find any more collisions, or when the time left to detect collisions is 0.

you can mail me your stuff, and I''ll have a look at it.

Share this post


Link to post
Share on other sites