Collision Detection docs?

Greetings,



Does anyone know of any docs explaining how to do detect for collisions with jME? Chapter 7 - Picking and Collision in the User's Guide is all empty apart from Picking, which did briefly described the theory behind some of this, but didn't include any useful examples. What I would like to do in particular is to make a vehicle (controlled by the player) follow some terrain geometry. Also, it would be nice to somehow specify a limit of how large an angle the vehicle should be able to rotate when following the terrain - i.e. it shouldn't be able to ride up walls.



I've managed the first part - to make the vehicle follow a loaded geometry by using code from jmetest.intersection.TestObjectWalking, although the vehicle is stuck when hitting the top of a pyramid-like shape :stuck_out_tongue:



Can anyone point me in some direction regarding this?



Thank you,

Johannes

look at the findCollisions method on spatial. Depending on the type of the CollisionsResults passed in it will either do bounding shape or trimesh collisions



HTH



Endolf

Endolf said:

look at the findCollisions method on spatial. Depending on the type of the CollisionsResults passed in it will either do bounding shape or trimesh collisions

HTH

Endolf


Hmm, ok. That's not exactly what I'm doing now. I'm doing as in  jmetest.intersection.TestObjectWalking:

camRay.getOrigin().set(cam.getLocation());
                camResults.clear();
                pickNode.calculatePick(camRay, camResults);



I'm not sure exactly what's going on here, but camResults is a TrianglePickResults with a custom processPick() method. It's also initializing by calling:


CollisionTreeManager.getInstance().generateCollisionTree(CollisionTree.AABB_TREE, terrain, true);



Is this needed if I want to detect collisions to triangle accuracy? What does this actually do? What could be the reason that my vehicle gets stuck when when hitting the top of a pyramid-shape? I'll have to investigate more, ofcourse, but it's really hard when there's no clear documentation on how collision detection works in jME...  :(

I'll look into findCollisions() and see if it might fit my needs better... Do I need a custom version of TrianglePickResults() then? If I want to for example make another node follow the triangles of the "terrain" node...