I just found a barbaric solution. I just realised that since in debug the problem doesn’t show up it’s because each frame is separated with each other. So… I just put some delay into the Ghost update loop like that :
private float lastCol = 0f;
private float threshold = 0.5f;
public void update(float tpf) {
super.update(tpf);
lastCol += tpf;
if (lastCol > threshold) {
if (this.getOverlappingCount() > 0) {
if (!actionDone) {
for (GhostAction action : actions) {
action.action();
}
}
actionDone = true;
} else if (this.getOverlappingCount() == 0) {
actionDone = false;
}
lastCol = 0f;
}
}
This idea came from tonegod in this Thread if people with the same problem show up in this Topic.