Page 1 of 1

Why is there no onCollision callback for collision shapes?

Posted: Sat May 28, 2016 1:16 am
by Evan407
Before I ever started I always thought CollisionObjects would have a callback for when they collide with another object. I have trouble believing this doesn't exist. Why doesn't this exists? It would be way better than iterating over everything.

Re: Why is there no onCollision callback for collision shape

Posted: Sat May 28, 2016 2:39 pm
by Jez Hammond
The forum's search doesn't always help even when we know what to look for!
This will get you started http://bulletphysics.org/Bullet/phpBB3/ ... f=9&t=7739

Re: Why is there no onCollision callback for collision shape

Posted: Mon May 30, 2016 12:27 pm
by Flix
I had made (5 year ago) a demo on how to easily do that without modifying the Bullet source code.
However, it's 5 years old... and worked with the old libBulletOpenGL.

Maybe you can still reuse most of the files in it...
I posted the demo here (see last post): http://www.bulletphysics.org/Bullet/php ... cks#p15604

Other solutions are either more complicated to set up or need modifications of the Bullet source code.
P.S. You can avoid using ghost objects in the first place most of the time if you use these files (at least, this was what I did 5 years ago...).
Jez Hammond wrote:This will get you started http://bulletphysics.org/Bullet/phpBB3/ ... f=9&t=7739
The solution proposed at the beginning of this post is very good if you don't use compound shapes and is faster than mine, but needs some modifications of the Bullet source code. However for demos and/or easy simulations it's what most users expect. Mine should handle compound shapes correctly but it's slower and does not require any modifications to the Bullet library (but it's 5 years old!).