How to simulate cylinder collider?

Please don't post Bullet support questions here, use the above forums instead.
Post Reply
ynm
Posts: 6
Joined: Wed Aug 14, 2013 2:36 pm

How to simulate cylinder collider?

Post 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
razer
Posts: 82
Joined: Sun Apr 04, 2010 10:08 pm

Re: How to simulate cylinder collider?

Post 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
RandyGaul
Posts: 43
Joined: Mon May 20, 2013 8:01 am
Location: Redmond, WA

Re: How to simulate cylinder collider?

Post 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.
ynm
Posts: 6
Joined: Wed Aug 14, 2013 2:36 pm

Re: How to simulate cylinder collider?

Post by ynm »

OK many thanks, both of you
Post Reply