sphere cylinder collision and distance

Started by
5 comments, last by manonoc 16 years, 2 months ago
Hi, What is the way to find the way to check if sphere is colliding with cylinder and then find how much the sphere should move along the movement vector before it reaches the cylinder surface? Thanks.
Advertisement
Collision between an infinite cylinder of radius R and a sphere of radius Q is the same as that of the cylinder's median axis and the sphere centered on the original sphere and with radius R + Q. Thus, your problem can be solved as a ray-sphere intersection.
Might be worth considering if you can use a sphere to capsule test (rather than sphere to cylinder). Then it would be a sphere to swept-sphere test.
It's like a sphere-edge test, with an added radius on the edge, and checking against caps.

Everything is better with Metal.

Quote:Original post by oliii
It's like a sphere-edge test, with an added radius on the edge, and checking against caps.


Oliii,

I have looked at your sweptsphere.zip samples.
It's very good and I have tried the Ray-AABB intersection and got it working.
But I am wondering how I can get the normal for the ray-AABB intersection using the slab method you did?
Ok, i managed to get the collision normal for the ray-AABB using the slab method.

Another question for intersection of ray and any objects.
It may be slightly stupid to ask but just would like to put ease of mind.
If I managed to find the point of collision, is it actually okay to add a distance of 0.00001f * collisionNormal to the position so that the object is slightly off the surface of sphere?

Please advise. Thanks.
Quote:Original post by juxie
Ok, i managed to get the collision normal for the ray-AABB using the slab method.

Another question for intersection of ray and any objects.
It may be slightly stupid to ask but just would like to put ease of mind.
If I managed to find the point of collision, is it actually okay to add a distance of 0.00001f * collisionNormal to the position so that the object is slightly off the surface of sphere?

Please advise. Thanks.


I use bisection method to find the position without collision, with the good precision, and one with good precision with collision to have the contact manifold (whom i take the mean to have just one contact (this in the triangle-triangle intersection))

manonoc

This topic is closed to new replies.

Advertisement