[SOLVED] RollingTheMonkey test ghost controls collisions not detected

:monkey: :monkey: :monkey:
Hello monkeys! (this is my first post… :monkey_face:)
:monkey: :monkey: :monkey:

…so, as per title, the jme3test RollingTheMonkey example from the library doesn’t seem to work as it should(or was intended to).
When the “Monkey Ball” step over the rotating cubes the score counter remain unaltered…

I tried to put some debug messages output in the overridden “collision” method and seems like the only two detected objects are only the ground and the player(a.k.a. Monkey Ball… :grin:), which it’s correct by the way, I mean, they’re touching eachother(:see_no_evil:), but what about the “ghost controlled” rotating cubes?

rollMonkeyTest_0_

I’m on the 3.2.2 stable sdk 1 / win7 x64 and the code is the following(I only added some debug console outputs):

@Override
public void collision(PhysicsCollisionEvent event) {
    Spatial nodeA = event.getNodeA();
    Spatial nodeB = event.getNodeB();
    
    String nameA = nodeA == null ? "" : nodeA.getName();
    String nameB = nodeB == null ? "" : nodeB.getName();
                 //   System.out.println(score + "COLLISION");

    if(nameA.equals("player") && nameB.startsWith("pickUp")) {
        System.out.println(score + " A");

        GhostControl pickUpControl = nodeB.getControl(GhostControl.class);
        if(pickUpControl != null && pickUpControl.isEnabled()) {
            pickUpControl.setEnabled(false);
            nodeB.removeFromParent();
            nodeB.setLocalScale(0.0f);
            score += 1;
            System.out.println(score);
            if(score >= PICKUP_COUNT) {
                messageText.setLocalScale(1.0f);
            }
        }
    } else if(nameA.startsWith("pickUp") && nameB.equals("player")) {
                        System.out.println(score + " B");

        GhostControl pickUpControl = nodeA.getControl(GhostControl.class);
        if(pickUpControl != null && pickUpControl.isEnabled()) {
            pickUpControl.setEnabled(false);
            nodeA.setLocalScale(0.0f);
            score += 1;
            System.out.println(score);
            if(score >= PICKUP_COUNT) {
                messageText.setLocalScale(1.0f);
            }
        }
    }
    else {
        System.out.println(nameA + "  " + nameB);
    }
    System.out.println(event.getNodeA() + "  " + event.getNodeB());

}

maybe the problem is in the ghost controls initialization/command sequence ?
or maybe the detection must be implemented differently for player/ghosted(:ghost:) objects ?

p.s. : the bot teached me how to use emojys… blame him! :laughing:

I guess the author @skidrunner needs a ping.

1 Like

It’s a known bug, which can be worked around by using jme3-jbullet or editing the source code or building from the master branch. Or you can wait for the next jMonkeyEngine release …

https://github.com/jMonkeyEngine/jmonkeyengine/issues/989

thanks, my bad I didn’t know how to look for fix/commitments in the release branches…
still, what does it refers to the 3.3-6680 notation?

1 Like

3.3-6680 refers to specific build of the Engine, corresponding to the 6680th commit in the master branch of the repository. Or something like that.