Hi Bobby,
> I've tried using the getTriggeringPath() method on the
> WakeupOnCollisionEntry object, but the path that is returned only includes
> the Locale object and one of the Shape3D nodes. I was under the
> impression that this SceneGraphPath object would have the entire path to
> this shape node.
When you call WakeupOnCollision*.getTriggeringPath() to get the
SceneGraphPath of the object that has collided with your collision
arming object, only the minimal nodes necessary to specify the
path to the object that collided will be put into the SceneGraphPath
that is returned. This is usually just a Locale, a Shape or Morph
object, and any Link nodes in between.
So in order to get Group nodes in the path returned as part of the
SceneGraphPath, you need to set the Node.ENABLE_COLLISION_REPORTING
capability bit of those Group Nodes, since this capability is not set
by default.
from javax.media.j3d.Node:
ENABLE_COLLISION_REPORTING
public static final int ENABLE_COLLISION_REPORTING
Specifies that this Node will be reported in the collision
SceneGraphPath if a collision occurs. This capability is only
specifiable for Group nodes; it is ignored for leaf nodes. The
default for Group nodes is false. All interior nodes not needed
for uniqueness in a SceneGraphPath that don't have
ENABLE_COLLISION_REPORTING set to true will not be reported in
the SceneGraphPath
I can think of one other way to solve your problem. If you do not
care which Shape node under a Group node has collided, only that
one of the Shape nodes has been collided with, then you can call
the Group.setAlternateCollisionTarget method on your Beaker class:
from javax.media.Group:
public final void setAlternateCollisionTarget(boolean target)
Causes this Group node to be reported as the collision target when
collision is being used and this node or any of its children is in
a collision. The default value is false. For collision with
USE_GEOMETRY set, the collision traverser will check the geometry
of all the Group node's leaf descendants; for collision with
USE_BOUNDS set, the collision traverser will only check the bounds
at this Group node. In both cases, if there is a collision, this
Group node will be reported as the colliding object in the
SceneGraphPath. This reporting is done regardless of whether
ENABLE_COLLISION_REPORTING is set for this group node (setting
alternate collision target to true implies collision reporting).
As you can see, when using Bounds, this will not be quite as accurate.
Hope this helps.
Travis Bryson
Sun Microsystems
> Date: Mon, 12 Apr 1999 01:07:30 -0400 (EDT)
> From: Bobby Kennedy <[EMAIL PROTECTED]>
> To: [EMAIL PROTECTED]
> Subject: [java3d] Collision Detection
> MIME-Version: 1.0
>
>
>
> I'm doing some work with collision detection and I've got a
> couple instances of a class 'Beaker' in the scene. A Beaker is basically
> a TransformGroup with a couple of Shape3D nodes off of it. I've got a
> different object in the scene that has the collision detection behavior
> attached to it. What I'm trying to do is determine which Beaker has
> hit this object when a collision occurs.
>
> I've tried using the getTriggeringPath() method on the
> WakeupOnCollisionEntry object, but the path that is returned only includes
> the Locale object and one of the Shape3D nodes. I was under the
> impression that this SceneGraphPath object would have the entire path to
> this shape node.
>
> Problem: how can I get the whole path from the Locale down to the
> Shape3D, or is there another way that I could figure out which Beaker this
> Shape3D belongs to (other than setting the userData for the individual
> Shape3D nodes)?
>
> Anyone have some ideas?
>
> Thanks,
>
> Bobby
>
> __________________
> University of Virginia, Computer Science IV
> [EMAIL PROTECTED]
> http://www.people.virginia.edu/~rwk4d
>
> =====================================================================
> To subscribe/unsubscribe, send mail to [EMAIL PROTECTED]
> Java 3D Home Page: http://java.sun.com/products/java-media/3D/
=====================================================================
To subscribe/unsubscribe, send mail to [EMAIL PROTECTED]
Java 3D Home Page: http://java.sun.com/products/java-media/3D/