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
How to simulate cylinder collider?
-
- Posts: 82
- Joined: Sun Apr 04, 2010 10:08 pm
Re: How to simulate cylinder collider?
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
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
-
- Posts: 43
- Joined: Mon May 20, 2013 8:01 am
- Location: Redmond, WA
Re: How to simulate cylinder collider?
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.
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.
-
- Posts: 6
- Joined: Wed Aug 14, 2013 2:36 pm
Re: How to simulate cylinder collider?
OK many thanks, both of you