Hello monkeys! (this is my first post… )
…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… ), which it’s correct by the way, I mean, they’re touching eachother(
), but what about the “ghost controlled” rotating cubes?
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() objects ?
p.s. : the bot teached me how to use emojys… blame him!