I have a vector in a 3D view, defined by a point p1(x1, y1, z1) and a rotation r1(x1, y1, z1). I can get a direction and a yaw. I need that vector to point another point p2 (x2, y2, z2). So I need a new rotation.
Coordinates: Coordinates are expressed like this: (5, 45, -12) This refers to the position where X=5, Y=45 and Z=-12. The 3 letters are called “axes”: Y is for the height. X and Z are for the horizontal position. Rotation: Yaw and pitch (radians). It can be converted to degrees.
I get this function, where d is the direction (vector between pos1 and pos2):
d = normalize(d); double yaw = Math.Atan2(d.X, d.Y); double pitch = Math.Asin(d.Z)
Is it Ok?
lookAt
functionality, have you tried searching for that term and how it works? Would that solve your problem? \$\endgroup\$