Place spatial on other spatial and move by motionpath

I have car spatial and a container spatial and when they collide I want the container to be set on the car spatial. The car is already on the right motionpath and the container is on another motionpath but has to be set on the car and follow the car’s motionpath. The car can drive on his motionpath but when collision with the container occurs the car and the container are going to wrong positions, the container moves on a motionpath but this is a non defined path. The idea is to attach the container and the car to a node, and add this node to the motionpath.


public void loadContainerOnAgv(Node rootNode){
       /* Under Construction*/
        CollisionResults output = new CollisionResults();
        BoundingVolume bv = agv.getWorldBound();


        for (Spatial container : Containers.spatialContainersArrayList){
            container.collideWith(bv, output);

       if (output.size()>0 ){
           motionControl = new MotionEvent(agvnode,pathagv);
           System.out.println("Child 0"+agvnode.getChild(0).getLocalTranslation());
           System.out.println("Child 1"+agvnode.getChild(1).getLocalTranslation());

       else {
         //  agvloadready=true;