This is when the target is onscreen.
This is the result from my code for the offscreen target.
The returned angle is wrong.
I create the arrow at a 2D position. My formulae is something like.
Code: Select all
TargetXY = Collide.getScreenCoordinatesFrom3DPosition(Target.getPosition())
TargetAngle = Vector2df.createFromVals(TargetXY.getX(), TargetXY.getY()).getAngle()
ArrowX = (Cos(TargetAngle)*(128-16))+(ScreenW/2)
ArrowY = (Sin(TargetAngle)*(128-16))+(ScreenH/2)
BTW I am writing my game for another programming language using a wrapper.