Hi, i need some mathematics with jME.
I would like to point a 3D arrow object to a certain position. The arrow is always in front of the camera.
Therefore I need to calculate the intersection angle between the direction vector of the arrow and the x-y plane (which has the normalized vector (1,0,0)) to rotate the arrow.
The general problem is done in math by: (I hopw you know what will follow^^):
sin.alpha = (|un|) / (|u||n|).
where u is the directional vector of the arrow and n the normal vector of the plane.
Problem: How can I calculate alpha with the functions provided by jME and FastMath?
With my calculator it would be sin^-1 ((|un|) / (|u||n|)).
By the way how are rotations applied to the spatial… as I attached the arrow to the cameraNode there will be actually TWO rotations for the arrow: first the inherited of the parent cameraNode and the second rotation is calculated by me.
I can think of two possibilities:
- the rotations are always applied as if the spatial has not been rotated at the begin of the frame, thus the second rotation overwrites the first rotation within the same frame
- the rotations are somehow added thus the second rotation "continues" the first rotation (which would be more complicated for me ;-()
Are there already examples / alternative ways which can point a spatial to a certain point? Otherwise I would continue with the intersection angle for calculating the proper rotation.