[SOLVED] Spatial rotation and direction when moving on path

after creating a new project with simple model i was experimenting with the rotations before lookAt command. for lookAt to work in correct directions, i need to rotate my model to be rotated towards camera location - before i tried every direction that came to my mind, but never tried the directions to and from camera…

        Spatial car = assetManager.loadModel("Models/race.obj");
        car.rotate(0, FastMath.HALF_PI, 0);
        
        Node carNode = new Node();
        carNode.attachChild(car);

after this, the car (and also the airplanes) are looking to where i want them. the movement is still not solved, but with correct directions i may try all types of rotation, if any would do what i need…

after fixing the lookAt direction, i tried the movement again and it was as bad as it was before. after trying different directions and rotation types, i discovered the setDirection() in MotionEvent, where i could set the upVector (the direction vector could be anything - i didn’t notice any change if i changed the first vector, it is probably overwritten by path direction). now the airplane moves, followes the path and its wings stay horizontal (it might be good to have them lean a bit in turns, but i am happy with it as it is)

this is the movement code now:

        Spatial actplane = mainScene.getChild(activePlane.getName());
        
        
        motionControl = new MotionEvent(actplane,path);
        path.enableDebugShape(assetManager, rootNode);

        motionControl.setDirectionType(MotionEvent.Direction.Path);
        motionControl.setDirection(new Vector3f(1,1,1), Vector3f.UNIT_Z);
        
        motionControl.setInitialDuration(10f);
        motionControl.setSpeed(3f);
        motionControl.play();