Hi all,
I've been looking to implement a target indicator. An arrow at the top of the screen that always points at my next selected objective.
I've been using the code in this topic:
http://www.jpct.net/forum2/index.php/topic,1385.msg9704.html#msg9704But that doesnt work as i want it to. the arrow seems to point at a point in the world when i move forwards and backwards
but when I rotate the helicopter, the arrow doesnt move and so the rotation goes all wrong.
It's probably to do with my setup:
playerLift (movement dummy)
playerTilt (rotation dummy - child of playerLift)
Player (helicopter model - child of playerTilt)
PlayerRadarDummy (dummy that positions the radarmap and compass - child of player)
PlayerObjectiveArrow (arrow mesh - child of playerRadarDummy)
WorldObjects is an Object3D array that holds my collection of objectives.
SimpleVector lookAtPoint = playerLift.getTransformedCenter().calcSub(WorldObjects.get(0).getTransformedCenter());
lookAtPoint.add( WorldObjects.get(0).getZAxis() );
SimpleVector direction = new SimpleVector(lookAtPoint.calcSub( object.getTranslation() ) );
Matrix rotationMatrix = new Matrix( direction.getRotationMatrix() );
PlayerObjectiveArrow.setRotationMatrix( rotationMatrix );
Any help would be much appreciated as this is the last piece of code to make my game work.