Steering mechanism

Important: The following is based on two plains; x & y - therefore z is always 0.

Given a target vector, and the following available variables for an (Node) object in space (NB: theres no need to use them all):

  1. a velocity vector,
  2. an angle of direction (current heading) as a float,
  3. a local translation vector
  4. a rotation magnitude float (defines how fast the object may rotate)

    How can I alter the local rotation, in accordance with the rotation magnitude, so that the object begins to rotate towards the target vector. (And stop once it is pointing towards it).

    I will be monitoring the node with a controller which does the following during its update method.

public void update(float time) {
   Vector3f prey = target.getWorldTranslation();
   Vector3f predator = missile.getWorldTranslation();
   if(!predator.equals(prey)) {
      float tc = sr.length() / vr.length();
      // st now represents the target location vector to move the missile towards
      // insert code to alter rotation of missile

The code was edited from an AI article in the wiki for steering behaviours to remove creating any Vector3f object.

public class Missile extends Node {
   private Vector3f velocity;
   private float degreeOfRotation;
   private float headingAngle;

   public Missile(float degreeOfRotation, float headingAngle) {
      this.degreeOfRotation = degreeOfRotation;
      this.headingAngle = headingAngle;

      getLocalRotation().fromAngleAxis(FastMath.DEG_TO_RAD * headingAngle, Vector3f.UNIT_Z);

   public Vector3f getVeocity() {
      return velocity;

   public float getHeadingAngle() {
      return headingAngle;

   public float getDegreeOfRotation() {
      return degreeOfRotation;