I have an object (the fishing Pole) which, when the rotation is 0x 0y 0z lies flat on the ground, pointing north. I would like it to point, like a compass, to an arbitrary object's location. As long as it's flat, easy - rotate Z.
The trouble is that I want it to point at a 45 degree angle somewhere above the other object... just like you'd stick a fishing pole in the ground, pointing toward a school of fish. But when I rotate the XY angles, it spins off into wild positions. Rotations in 3D space is a [censored], lol.
I plotted the desired end points for north, south east and west:
315x 000y 000z n
000x 045y 090z e
045x 000y 180z s
000x 315y 270z w
I know enough to recognize this is a sine/cos/tan equation, but my math experience was limited to Math 001 "Math Without Fear" so this is a little beyond me.
;; get heading angle. This works just finefloat zOffset = deployedPole.GetHeadingAngle( closestCritterFish )float angleZ = deployedPole.GetAngleZ() + zOffset;; After we rotate to z-point at fish, tilt pole 45deg... but this obviously doesnt work:float angleX = Math.Sin(45)float angleY = Math.Cos(45)deployedPole.SetAngle( angleX, angleY, angleZ )Question: Knowing my rotation angle Z, how do I solve for XY so that the object in question is always 45-degrees to the ground?