Yet more noob questions

greeting everyone !!

Before I present my problems I would like to say you guys have done a GREAT job with jMonkey.

I'm very excited about it, and I have been reading / trying / coding some things out with the API.

I created a model in 3dsmax and a basic level, that looks like an arena - a rounded area where the players should fight - with some obstacles, walls, pillars, block, etc.

I have created a basic game, based on the tutorials, imported the models into it and created a camera that simulate a 1st person view. The camera follows the model and turns with it, as we move it around the level.

So far, so good. My biggest problem is when I try to check for collisions with the walls or objects on the level (the ground isn't a problem, cause its flat, and I keep the players a little above it all the time).

Looks like as soon as the game begins it start to fire the collision events, cause the geometry i imported from 3dsmax is too complex and the boundbox surrounds it all… ans my player being inside it… :frowning:

question: is there a way I could check the collision against each mesh of the imported object? I have created 3 Nodes: one for the ground, one for the circle walls and one for the obstacles… Only the simple obstacles seems to works as intended…



Ok, guess I found a way to get the collisions between the meshes and not the boundboxes. I get a message when my model collide with the complexes meshes I imported from .3ds files.

private Node nodeWalls;
private Node player1;
private TriangleCollisionResults results;

private void buildWalls(){
    nodeWalls = loadModel("arenaWalls.3ds");

private void buildPlayer() {
    model = loadModel("player.3ds");

and the method updateCollisions() is in the main update loop:

private void updateCollisions() {
    Vector3f lastValidLoc = player1.getLocalTranslation();
    player1.findCollisions(nodeWalls, results);
    if(results.getNumber() > 0){
        for(int i = 0; i < results.getNumber();i++){
            CollisionData data  = results.getCollisionData(i);
   System.out.println("Collison between "+data.getSourceMesh().getName()+" - "+data.getTargetMesh().getName());

I'm getting the message when my player collides with a wall or any object of the imported mesh.
Now the problem is my player is not going back to its last valid position... :(
Any ideas why??
Would appreciate a little input,




    Vector3f lastValidLoc = player1.getLocalTranslation();

stores a reference to the vector that represents the location of your player. That vector is altered afterwards!
You should do

Vector3f lastValidLoc = new Vector3f();

and update it each time the location is valied with


This way you copy the values.
To move your player back to the last valid location execute

player1.getLocalTranslation().set( lastValidLocation );

(again copy values not reference)

And: Welcome to jME :)

Geez I'm so dumb… of course.

Thanks irrisor.