chandlerprall / Physijs

Physics plugin for Three.js
MIT License
2.75k stars 455 forks source link

Nested Collisions Help #247

Open mjkaufer opened 8 years ago

mjkaufer commented 8 years ago

I'm trying to identify when a collision occurs between two meshes I've created. The problem is that one of the meshes is nested into a bunch of THREE.Object3D objects, so the collision isn't being detected. When I add another object directly to the scene ( scene.add(myObject) ), the collisions between that object and the other object at the top of the scene are recognized. However, there is still no collision detected between the mesh inside of the THREE.Object3D.

Is there a way to have Physijs detect collisions between meshes which are a direct child of the scene object, and meshes which are a child of a THREE.Object3D, which is a parent to the child?

Thanks!

ghost commented 8 years ago

@mjkaufer don't you just need raycasting? THREE.js already has it fully implemented, just need to use it. If you set the 'recursive' parameter to true when checking collisions, it does so for the children too.