I'm writing a small game base on jme engine. It's very interesting but my poblem is:
I loaded 2 models: a stadium model (stadium.3ds) and player model (player.3sd). Them i want my character move around the stadium but must stop went meet a wall. So i try some collision detection. Here is my code (inside update() method):
results= new TriangleCollisionResults();
You're checking only bounding collisions. change the hasCollisionMethod to
if(data.getTargetMesh().hasCollision(data.getSourceMesh(),true))
and be sure that updateGeometricState has been called for both models
when i change the hasCollision method to:
if(data.getTargetMesh().hasCollision(data.getSourceMesh(),true))
then nothing happen when i meet walls (i tried to use updateGeometryState() in update() method, but nothing happen)
sorry wrong method(not updateGeometricState
you call the updateCollisionTree() when you load the models
Node myNode = loadModel();
myNode.updateCollisionTree();
i tried but nothing happen. I also add:
scene.updateGeometricState(interpolation, true);
in update() method.
And method updateGeometricState need 2 @para: updateGeometricState(float time, boolean initiator), could you show me how to use this method and 2 @para.