Hi,
i am currently working on a simulation of a rotating can with one ball in it. The can is build from box shapes using a compound shape. I need to register the moment of the ball leaving the can. My question is: Does somebody has any idea of how to reuse bullets collision lib in order to tell when the ball leaves the can?
I thought of using a box B having the same size of the can whose orientation/motionstate is set to the can's orientation/motionstate for each time step. Then maybe using collision detection between the box B and the ball to detect if no collision is triggered, concluding that the ball has left the can. Would this be possible?
Thanks for helping me.
Way for reusing bullets collision lib for different purpose?
-
- Posts: 5
- Joined: Tue Nov 24, 2009 3:58 pm
-
- Posts: 28
- Joined: Tue Jan 05, 2010 12:41 pm
Re: Way for reusing bullets collision lib for different purpose?
Hi,
hope, this is going to help you: http://bulletphysics.org/mediawiki-1.5. ... d_Triggers
hope, this is going to help you: http://bulletphysics.org/mediawiki-1.5. ... d_Triggers
-
- Posts: 5
- Joined: Tue Nov 24, 2009 3:58 pm
Re: Way for reusing bullets collision lib for different purpose?
Thanks mako90,
i already know the link but what i am really after is an advise from someone how to solve the problem with bullets collision library or if it's even possible to solve it with the collision lib. Do you think that my suggested solution can work?
i already know the link but what i am really after is an advise from someone how to solve the problem with bullets collision library or if it's even possible to solve it with the collision lib. Do you think that my suggested solution can work?
-
- Posts: 28
- Joined: Tue Jan 05, 2010 12:41 pm
Re: Way for reusing bullets collision lib for different purpose?
Hi,
I thought that
<pre>gContactDestroyedCallback
This is called immediately after the contact point is destroyed.
typedef bool (*ContactDestroyedCallback)(
void* userPersistentData);</pre>
is the solition. If I'm correct, this is the function called when the collision is destroyed. Does the ball touches the can?
I thought that
<pre>gContactDestroyedCallback
This is called immediately after the contact point is destroyed.
typedef bool (*ContactDestroyedCallback)(
void* userPersistentData);</pre>
is the solition. If I'm correct, this is the function called when the collision is destroyed. Does the ball touches the can?
-
- Site Admin
- Posts: 4221
- Joined: Sun Jun 26, 2005 6:43 pm
- Location: California, USA
Re: Way for reusing bullets collision lib for different purpose?
What is your definition of 'leaves the can'? Is the ball leaving the can if it has no contacts (but it can be inside)? Or do you want to measure if the ball is still overlapping with convex hull of the can? If so, you can use a convex hull shape and perform collision detection with that.when the ball leaves the can
Thanks,
Erwin
-
- Posts: 5
- Joined: Tue Nov 24, 2009 3:58 pm
Re: Way for reusing bullets collision lib for different purpose?
Thanks Erwin,
yes i want to measure if the ball is still overlapping with the convex hull of the can. Can i use two collision shapes for one and the same rigid body, one for real collision detection and one for only detecting if the ball is completely outside the can? If yes can you give me some example or any link?
Thanks,
Thomas
yes i want to measure if the ball is still overlapping with the convex hull of the can. Can i use two collision shapes for one and the same rigid body, one for real collision detection and one for only detecting if the ball is completely outside the can? If yes can you give me some example or any link?
Thanks,
Thomas