Hi, I’m trying to set up a mechanic in Unreal Engine where the character plays a bow-shooting animation only if the mouse cursor is hovering over an enemy object when I right-click.
Here’s what I’m trying to achieve:
1. On right mouse button click:
• Check if the mouse cursor is pointing to an enemy object in the game.
• If an enemy is under the cursor, trigger the bow-shooting animation.
• If no enemy is detected, nothing happens.
2. I am currently using Get Hit Result Under Cursor by Channel to detect objects under the cursor.
• I know that Hit Actor can be used to identify the object under the cursor.
• I plan to use tags (like “Enemy”) or check the object’s class to determine if it is an enemy.
My question is:
• How can I properly set up this mechanic in Blueprints so that the animation only plays when an enemy is detected?
• Am I using the right approach with Get Hit Result Under Cursor by Channel?
• Are there any potential pitfalls I should be aware of when implementing this feature?
Any help, advice, or example setups would be greatly appreciated!
Thank you!