I have been thinking about how aiming is done in third person games where the player is not centered in the middle of the screen, especially with regards to bow and arrow mechanics. We would have to rotate the player along global y axis and rotate their torso and arms along global x axis to align the projectile with the target. I'm interested specifically in the y axis rotation. The issue is that reticle is defined in screen space and we need to transform it into world space. To do this we need to define what the z coordinate is and we can't get that information from the reticle. I guess one way to get the third dimension would be to cast a ray from center of the camera towards the reticle and check for the closest collision. However one issue I'm having with this is what if player wants to aim higher than the target. For instance slightly higher than the enemy head, since the projectile's y coordinate will get decreased with distance. In this scenario the ray doesn't collide with anything and we are not shooting where we want to shoot. Does anyone know of any potential solutions to this?
I just watched some gameplay from games like Tomb Raider and Horizon Zero Dawn, which had some good feeling bow and arrow mechanics, and it seems like they are using a constant set z value and not define it based on camera ray intersection? What do you guys think?