Why is there no onCollision callback for collision shapes?

Post Reply
Evan407
Posts: 22
Joined: Sun Jan 17, 2016 2:37 am

Why is there no onCollision callback for collision shapes?

Post 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.
Jez Hammond
Posts: 7
Joined: Tue Apr 12, 2016 12:53 pm

Re: Why is there no onCollision callback for collision shape

Post 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
Flix
Posts: 456
Joined: Tue Dec 25, 2007 1:06 pm

Re: Why is there no onCollision callback for collision shape

Post 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!).
Post Reply