I’m struggling to accomplish a task. I included a photo to better represent what I am trying to achieve.
When the AI fires a cannonball it flies up and over a mountain and it may hit an obstacle before reaching it’s intended target. Just before the cannonball gets destroyed I want to test to see if it is lined up to hit the target or miss it. This data will help me calculate the next shot.
Since the 2D Sprite representing the cannonball doesn’t return any rotation information, I must rely on the RidgidBody2D and physics. But transferring that information to the Raycaster2D has me baffled at the moment.
The RidgidBody2D has a member that is Rotation (float around the X Axis). But the Raycast2D has a direction parameter for direction that takes a Vector2(); I am guessing that I am looking the wrong place to achieve this task?
Any help much appreciated.