Page 1 of 1

How to simulate cylinder collider?

Posted: Tue Sep 17, 2013 9:42 am
by ynm
Hi

AFAIK, many engines don't incorporate the cylinder shape because it is expensive than basic shapes like sphere or rectangle box. I did some searches but could not find any light on this. So how does bullet simulate cylinder mathematically?

Regards

Re: How to simulate cylinder collider?

Posted: Tue Sep 17, 2013 10:44 am
by razer
The only difference between Sphere and Cylinder is collision detection algorithm.
After contact point is detected then same solver is used for all objects.
Every pair of shapes have there own narrowphase collision detection algorithm.
You may debug bullet code to see what code detects collision of cylinder and other object in your case.
It would not be hard if you will have only 2 objects in your world.
Firstly Broadphase will detect possible pair of colliding objects.
Then go forward and look what happen s in your code

Re: How to simulate cylinder collider?

Posted: Wed Sep 18, 2013 1:59 am
by RandyGaul
Cylinder would best be represented implicitly, as in with a vector (or two points) and radius scalar (or some other variation).

One reason collision detection like this is uncommon because it might require additional authoring for special collision detection routines. If you are hand-writing collision detection routines for various collider types, the number of routines you might have to write is on the order of N^2, meaning that you really don't want to add new collider types once you get above a handful of different kinds.

Generalized algorithms are commonly used to where an approximation of nearly any desirable shape can be achieved.

Edit: I myself can think of, off the top of my head, some very fast collision tests involving a cylinder. I don't think efficiency is the issue here at all.

Re: How to simulate cylinder collider?

Posted: Thu Sep 19, 2013 5:47 am
by ynm
OK many thanks, both of you