chandlerprall / ThreeCSG

CSG plugin for Three.js
MIT License
453 stars 152 forks source link

Intersection 'detection'. :) #15

Open electricessence opened 10 years ago

electricessence commented 10 years ago

Since geometries can get complicated, I wonder if there is a way (maybe using these techniques) that could 'detect' if two geometries intersect. I've noted that you can call intersection on an object, and if there are 0 (zero) nodes in the tree then it indicates that they are NOT intersected. This is useful, but where I struggle is I wish there was a way to detect if complex geometries intersect in the world regardless of what child/parent structure they have.

Any ides?

chandlerprall commented 10 years ago

What kind of convex geometries do you have? Are the geometries themselves concave or is it an object made from parent/children that are all convex?

electricessence commented 10 years ago

So I was able to do this. But the sucky part is that I'm isolated to the local coordinate space of the two geometries. I couldn't simply create an object and then another an see if they intersect/collide regardless of their scale or alignment. :|

chandlerprall commented 10 years ago

Are you using the BSP tree for anything other than trying to get collision detection?

electricessence commented 10 years ago

Well in this case yes. I simply want to know if two complex objects intersect. But like I said, it get's sticky when you have an object that has scale factor, rotation, position, (in the world space) that is different than the other. :(

electricessence commented 10 years ago

I would be happy if I ask if a single point lived inside of a complex object (geometry), that would do it for me.