Physics collision detection

How do I do manually do some collision detection (probably a sphere) in a script and react to them in a custom way?
Is it even possible (in a simple way)?

So you want to do a an arbitrary collision check, as in you don’t have an existing object that you want to check collisions on, you just want to see if there is any object that would contact a sphere of a certain radius at at certain point?

I think that there will be a simple enough way to do this, but there needs to be additional physics bindings to Haxe. I’m going to be adding the ability to do that ( because I needed the same thing ) after some PRs for automating the bindings are merged.

You can subscribe to that thread, or ping me after it gets merged if I don’t remember to come back and update you on this. :slight_smile:

Just checking a sphere at a position would probably be enough, similar to raycast. But perferable I get some information, like where the exact contact point is.

Currently I’m trying this:

  • set some rigid bodies to the position of an animated object
  • do physics
  • increase the position of the parent of all animated objects to the average of the offsets from the animated child objects

Not sure if it will work. But if I don’t get it work this way, it probably won’t work with this PR either.

OK, that is outside of my experience. What I was thinking for the contact test is that we can expose the btCollisionWorld.contactTest() function of Bullet so that you could do arbitrary collision tests in your script. I don’t really know about the rest of it. If contactTest() was exposed, it should give you the exact contact points, just like you can get when checking the contact points between Rigid Bodies already.

If you are just wanting to check contact points on a Rigid Body you can use PhysicsWorld.getContactPairs().