I have a car spatial and a container spatial and after collision I want the container to be set on the car.
Container on agv method
public void loadContainerOnAgv(Node rootNode){
/* Under Construction*/
CollisionResults output = new CollisionResults();
BoundingVolume bv = agv.getWorldBound();
// {
Containers.container.collideWith(bv, output);
//added
if (output.size()>0 ){
agvnode.attachChild(agv);
agvnode.attachChild(Containers.container);
rootNode.attachChild(agvnode);
motionControl = new MotionEvent(agvnode,pathagv);
output.clear();
motionControl.play();
agvloadready=false;
}
else {
// agvloadready=true;
}
// }
}
Code in main
@Override
public void simpleUpdate(float tpf) {
agvtransporter.loadContainerOnAgv(rootNode);
}
The problem is that after collision the car disappears and the container follows a path but it’s another (non defined) path then the pathagv. The location of the agv node is 0.0.0 , this is intended behaviour?, but I want to set the agv node location to the point on the motionpath where the collision occured.