Will any of the new versions of Codea incorporate automatic collision detection of 3D meshes?

@John,

I’m working on a demo project now where there are multiple 3D models that the user can attach to and move of different sizes (e.g. a crab, a pirate, and a ship) and was wondering if any of the newer versions of Codea might have a way of automatically detecting collisions between such models. That might be handy as right now I’m having to readjust my ray/spherecast to detect if the 3D space in front of the 3D model the user is attached to is open for the 3D model character to move through it (e.g big enough space for a crab versus pirate versus a ship to pass through).

Thanks for the consideration. :slight_smile:

I’m not sure what you mean by automatically detect collisions? Do you mean some kind of callback to inform you of when a collision happens?

Or maybe, he talk about friction and bounce.

@John In V3 Codea, the physics code does automatic collision detection, and there’s also the function collide that gives information about the collision when it happens. I believe that’s what being inquired about in V4.

In that case, I haven’t got it working yet but I it will have collision callbacks. In V4 you create a physics world (instead of there being one global world) which you can use. You can also create a scene which has automatic 2D and 3D physics which works with bodies and colliders (formally called shapes)

I’ll make and release some examples of how to use this soon

Thanks, Everyone.

I apologize for not being more specific. Yes, @John, I’m interested in a callback that informs me when a collision happens to a 3D mesh object. Currently, I put rigid bodies around the mesh objects in my projects and then cast a ray or sphere out from the 3D mesh object I’m intending to move and see if it hits another rigid body in the path I Intend to move the 3D object. If it does, I don’t allow the 3D mesh object to move; otherwise, I move the object. However, it then seems I need to customize my ray or spherecast for each different sized object I intend to move (i.e. a smaller radius spherecast if I am looking for a small 3D object to move through a space and a larger radius spherecast if I need more space for a larger 3D object to move through space). I was thinking that it would be helpful if I didn’t need to create ray or spherecast at all to determine if the space is blocked in front of my 3D object and instead rely on the craft.physics system to autodetect my 3D object with a rigid body colliding on its movement with another 3D rigid body and letting me know that by a callback at which time I would have the code stop the 3D object’s movement. // I’m open to others’ suggestions on how they think is best to detect a 3D object in the way of a 3D object I intend to move.

Thanks!

In terms of detecting collisions and being notified via a callback, this will be supported. 2D physics in Codea 4 has the entity.onCollisionBegan callback that you can set on an entity or one of its components. There will be a 3D equivalent of this when I get time to fully integrate it. There will also be a way to access collision events for the entire physics world if needed

I’m in the process of changing over to Jolt physics from Bullet3D which will yield some new features and performance improvements

That sounds great, @John, thank you very much!