How to use PhysicsCollisionListener?

If first collision with this object, change score.

What is difficult about that logic?

Take a look at this example:
jmonkeyengine/RollingTheMonkey.java at master · jMonkeyEngine/jmonkeyengine · GitHub

I do not know how to know when it’s the first collision, I do not know how to get that parameter

OK, thank you very much, I’ll look at it.

It’s not a parameter. It’s your game, your code, your state that you keep track of.

Make a field on the object. Set it to true when it first collides and change the score. If that field is true already then don’t change the score.

Is that just like this function every time it ends it is destroyed, even if I use a boolean it is destroyed and it is created many times, therefore if I use that boolean in the function simpleUpdate to verify I always have the same result … it is always the same thing I get as a result, a score greater than 8 and multiply that by 8 times … XD
Google translator

 public void collision(PhysicsCollisionEvent objetoColisionado)

Your objects are involved in the collision. You can set fields on those objects.

I think that this is the solution I am going to dedicate some time to this code. Thanks

Is there anything in the documentation related to this that you name =?

I mean, it’s basic Java.

if( !myObject.getTheFieldThatIDefine()  ) {
    myObject.setTheFieldThatIDefine(true);
    incrementScore();
}

The event object has your objects in it. Those are your objects that you defined. Either a custom class or a spatial or something. For your own classes, just define the fields. Basic Java programming. For Spatial, you can use setUserData() for the same thing.

OK, I’m going to try it … I’m going to think about all the information they gave me and I’m going to ask you again any … thank you very much for your time