![]() |
Intersect vs collision
Is it more efficient framewise to detect collisions with viz.intersect()
or physics collide callbacks? |
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. |
line touching cylinder
I am trying to detect when an on the fly line is in contact
with a cylinder. Which method would be most efficient? |
In this case collision callbacks won't work, so you need to manually call the intersect function yourself.
|
FYI the collision callback method does work with an on-the-fly line if you
specify .collideBox(). It doesn't work with .collideMesh(). |
Quote:
|
Yes, the callbacks will still work when you are dragging an object. Like I mentioned above, you will need to explicitly enable collision notifications on an object for a callback to be triggered.
|
Quote:
made a bunch of screws and said this for each one: Code:
screw.collideCapsule() Code:
currentBox.collideMesh() #make a collision mesh so we know when screws hit it Code:
|
try doing this
currentBox.collideMesh() currentBox.enable(viz.COLLIDE_NOTIFY) currentBox.enable(viz.CONTACTS) hope that was helpfull :D |
All times are GMT -7. The time now is 02:01 AM. |
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
Copyright 2002-2023 WorldViz LLC