I want to make 3D FPS, but don’t see the way to determine Z coordinate for point of view. Raycast determine only X, Y coordinates of ray intersection with object, but not Z. I used 3d shooting range example as reference, but it also don’t determine Z coordinate. There’s no difference if I shoot straight to the target or lower or higher.
Is there a way to determine Z angle of camera or Z coordinate for raycast?
Currently raycast is a 2D function. You could make it a 2 step process. First perform a raycast, then determine if the elevation of the intersected object is correct - multiply the distance by the tangent of the angle.
I’m not sure what you mean by that, but here’s my guess:
If you’ve got the z-axis perpendicular to the screen (going in/out of the screen) it’s the object.Angle() value.
But if you’re rotated the object along the y-axis so that the z-axis goes up and down the screen, then it’ll be the object.Object3D::RotationX() value.