setCollidable(false) on EVERY object that u don't want to detect
collisions with. If u r in a state of constant detection, then i can
suggest there is some terrain beneath your fan array and what u do
detect is the collision with it. Remember that u can detect only 1
collision between 2 objects at a time, which means that once u entered
a collision no collisions would be detected until u exit the first
one. U can also play with setBoundsAutoCompute(false) - can't recall
whether it influences smth in Collision detection via BOUNDS or not.

And one more thing. If u have compound nodes then it is more
difficult. Again, can't recall exactly right now, but the deal is that
if u want to catch a collision with some child node, bounds of a
parent node influence the detection drastically. In the same time, if
u setCollidable(false) on a parent node, u wouldn't be able to detect
collisions on a child node as well (again, it's very high probability
that it's really like that, but can't say 4 100% - was tooooo long
ago). The solution i came to was to separate visual elements (eg, house,
windmill, any other object) from collision detection as follows:

                 ElementGroup
                       |
                       |
                      / \
   addChild(visEl)   /   \  addChild(dumSh)
      --------------/     \-------------
      |                                |
      |                                |
 VisualElement                    DummyShape (eg, Point)
(Shape3D, Group,                  with setCollidable(true)
 etc with
 setCollidable(false)


The code 4 dummy shape is:
--------------------------
import javax.media.j3d.*;
import javax.vecmath.*;

public class DummyBox extends Shape3D
{

  public DummyBox(float width, float height, float depth)
  {
    super();
    Point3f point = new Point3f();
    PointArray pointArr = new PointArray(1, GeometryArray.COORDINATES);
    pointArr.setCoordinate(0, point);
    this.setGeometry(pointArr);

    BoundingBox dummyBounds = new BoundingBox(
      new Point3d(-width/2, 0f,    -depth/2),
      new Point3d( width/2, height, depth/2));
    this.setCollisionBounds(dummyBounds);
  }

}

Should work just fine.

vladimir
             -=V=-
>-------<=============>-------<
Join in Java community now!
http://JavaCafe.VirtualAve.net/
>-------<=============>-------<

In your previous letter u wrote:
--------------------------------
CP> When I use the USE_GEOMETRY flag for collision detection the rendering
CP> performance is slow. The object that detects collisions is made from a triangle
CP> fan array.

CP> I would like to use the USE_BOUNDS flag (as I assume the rendering would be
CP> faster for this) but whenever I set it the collision detection does not work -
CP> it is in a state of constantly detecting a collsion even though none is
CP> occuring. I have got the collision bounds set up but it seems to take no notice
CP> of it. Changing the parameters of the bounding sphere seems to have no effect.

CP> I am assuming I have the collision detection set up correctly as the
CP> USE_GEOMETRY flag produces the correct output - just at an unacceptable
CP> rendering rate. I think the problem may lie with the collision bounds but I'm
CP> not 100% sure.

CP> Does anyone have any suggestions?

CP> Thanks in advanced.

CP> Chris

CP> ===========================================================================
CP> To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
CP> of the message "signoff JAVA3D-INTEREST".  For general help, send email to
CP> [EMAIL PROTECTED] and include in the body of the message "help".

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA3D-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to