Collision detection

Myriade
Posts: 2
Joined: Sun Jun 07, 2009 3:24 pm

Collision detection

Post by Myriade »

Hi

I am trying to do collision detection using bullet. I have arrows and a bear. I need to detect when they collide, and then create a constraint that sticks the arrow to the moving bear once they collide

Actually, I am lookin for a small example with a peice of code that I could use as a base for that issue in my project.

Trying to figure out about manifolds, manifoldPoint and so on... Can I loop only on the points involving the bear, and not each other object ? (not involving the bear).

Next, I will need to know which kind of constraint I will need to create. It needs to connect the arrow and the bear together, so that their relative position stays the same. I think it is a btConeTwistConstraint that i will need to create. Do you know example and piece of code about that?

Thank you in advance.
sparkprime
Posts: 508
Joined: Fri May 30, 2008 2:51 am
Location: Ossining, New York

Re: Collision detection

Post by sparkprime »

I think you probably want to pick up the collision at the 'contact added callback', see the wiki for a page about that.

Don't use a constraint to stick the arrow to the bear, instead either fuse the two collision shapes or just ignore the collision mesh of the arrow, i.e. draw the arrow at the right place as the bear moves around but remove the arrow from the physics world.