![]() |
|
#2
|
|||
|
|||
|
viz.intersect() is different from physics collision callbacks. viz.intersect() returns collisions over a line. The physics callbacks are triggered when two objects collide. So it depends on what you need.
If you need line intersection tests, then viz.phys.intersectLine() will be much faster than viz.intersect. However, viz.phys.intersectLine() only returns results for objects that are part of the physics simulation. So you must define a collision volume for each node that should take part in the intersection test. If you want know when two objects are colliding then you have two options. Use the physics collision callbacks. You must explicitly enable collision notifications for each object that you are interested in: Code:
node.enable(viz.COLLIDE_NOTIFY) In general it is more efficient to handle collision callbacks than to manually query for intersections every frame. |
|
|