Hi there,

I've got a scene graph that basically looks like so (hope this formats
alright):

       Root
      /  |  \
   TG1  TG2  TG3
         |    |
        BG1  Box
         |
       Cube

And what I'm trying to do is move the branch BG1 (and its child) onto TG1
when the Cube enters a collisoin with the Box; then move it back to
TG2 when it exits the collision.

(Collision detection code is below) The problem is that the collision
detection freaks out when I do this.  If I intersect the cube with the
box, the collision detection flips between in and out even if the cube is
stationary and in contact with the box.  

If I pass TG2 (the original root) as both the source and the
destination it behaves normally.  But if I pass TG2 as the source and
TG1 as the destination it goes crazy.  Both TG1 and TG2 have the same
transformations so the box shouldn't be moving when switched.

Any ideas on this one?

The relevant code is below.

Thanks,

        Bobby


//root is a the original group (TG2)
//dest is the destination group (TG1)

public void processStimulus(Enumeration criteria)
{
  inCollision = !inCollision;
  if (inCollision) 
  {
    SceneGraphPath path = wEnter.getTriggeringPath();
    System.out.print("IN");
    
    //Capabilities are set to get the BG above the cube when in collison
    ((BranchGroup)path.getObject()).detach();
    dest.addChild((BranchGroup)path.getObject());
    wakeupOn(wExit);
  }

  else
  {             
    SceneGraphPath path = wExit.getTriggeringPath();
    System.out.print("_out_");
    ((BranchGroup)path.getObject()).detach();
    root.addChild((BranchGroup)path.getObject());
    wakeupOn(wEnter);
  }
}


__________________
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/

Reply via email to