(Urgent) Is collision tree required(create and update) for trianglePicking?

Hi there,

I throw a ray and use triangle picking for line of sight - is it required to create collision tree and update it?? Generally I have done collisions using bounding so have no idea. If so could you provide a small snippet of how to do so? I have to give a demonstration tomorrow morning so any help would be very appreciated. I do it as follows(for 4 bots) - example of 1 is below:

public boolean lineOfSightGuard()  //improve sight to three rays
        Vector3f gP = guardNode.getLocalTranslation();
        Ray ray = new Ray(guardNode.getLocalTranslation(), guardNode.getLocalRotation().getRotationColumn(2));
        PickResults results = new TrianglePickResults();
        if(results.getNumber() > 0 && results.getPickData(0).getTargetMesh().getParentGeom().getParent().getName() != "Walls"
                && player1.getWorldBound().intersects(ray))         
            System.out.println("Inside the first loop - Guard");
                                                                                 //three are itself as explained
            //shootAtPlayer(enemyNode, ammoEnemy);                                                                  //in the post
            System.out.println("!!!!!!!!!!!!!!!!!Player spotted - Guard!!!!!!!!!!!!");
            return true;
            return false;


Generally speaking using a ColisionTree will greatly speed up the triangle collision test. The only reason why you would not want to use it is if you lack memory or your scene changes very quickly. You could try clearing all collision trees from the manager once they are no longer needed, which should work in most cases. Otherwise, I suggest you take a look at the source and see if any work-arounds the system are available.

My scene does change e.g. in terms of triangle collision detection as four guards that use it move around constantly detecting different objects. But none of them uses a collisiontree. I just wanted to know that if I dont use collisiontree then will it cause any errors - e.g. in one of the guards line of sight, it has decided to go awol for some reason and detects player when it clearly shouldnt. And also it gives errors(without exiting) written in console saying no trianglecollisions detected when it is clearly surrounded by loads and loads of geometry.

It was working perfectly and for some reason it has decided to play up at the last minute.

WARNING: Couldn't detect nearest triangle intersection!
20-Mar-2008 02:36:11 com.jme.intersection.TrianglePickData getDistanceSquaredToTriangle

p.s. by the way thank you very much for your code on AI pathfinding. The syntax wasnt right as you predicted but the idea was right and although I did not get enough time to implement it, it will help immensely in design part of the report.