How to control rotation speed?

Hello everyone, this question may sound stupid for you but i cant figure out how to change the speed at which an enemy ship rotates towards the player. Plz dont post anyhateful comments its only a month i got into jme . Here is my code:

protected void controlUpdate(float tpf) {
        Vector3f playerDirection = player.getLocalTranslation().subtract(spatial.getLocalTranslation());
        playerDirection.normalizeLocal();
        playerDirection = playerDirection.add(velocity);
        velocity= playerDirection.normalizeLocal().mult(speed);
        if (spatial.getLocalTranslation().distanceSquared(player.getLocalTranslation()) >        2000){
            float actualRotation = Main.getAngleFromVector(playerDirection);
            if (actualRotation != rotation) {
                spatial.rotate(0, 0, actualRotation-rotation);
                rotation= actualRotation;
          }
    spatial.move(velocity);
    }

Note:its a 2D game, the spatial seeks the player and rotate in its direction fine, i only want to control the speed at which it rotates.Thanks for your help.

To post code please precede it by a line of 3 back ticks: ` And also follow it by a line of three back ticks.

Note: not a single quote ’ but a back tick `… three times.

The hello tutorials explain this, you basically change it using tpf and a multiplicator.

you mean something like that ?

spatial.rotate(0, 0, (actualRotation-rotation)*0.8f);

actual ive tried and it makes the spatial rotation in a wrong direction i.e not exactly towards the player. Maybe its my logic which sucks anyway thanks any suggestions are most welcome.

I’ll try to make my response look as nice as your original post (still unfixed with respect to code blocks)… :wink:

Where
does
rotation come
from?

Generally, it is
unnecessary

to deal with angles
in
such cases.

as
quaternions can
be
interpolated

directly.

Dude, do you even tpf?
http://wiki.jmonkeyengine.org/doku.php/jme3:beginner:hello_main_event_loop