- Home /
Problem with anims when attacking
Hello, i'll do it specific. In my fps game, i have a melee system, and i did a secondary hit with the right click in the mouse, obviously different from the normal hit with the left click.
So, i want the game to detect when im hitting the air or hitting and causing damage to an enemy (WITH THE RIGHT CLICK!) and then playing an anim or another depending which case it's.
I dont need anims, i would like some help with the scripts that the system needs.
Thank u.
How have you attempted to solve this issue? And why didn't it work out? We're not here to write your code for you.
I dont have enough knowledge to do all by myself, i tried but i didnt figure it out. I know u arent here for that, i just want an idea or something that could be useful for me to do what i want.
Sorry, i hope u can understand me, im basically new around here.
Answer by getyour411 · Jan 19, 2015 at 04:17 AM
The first method that comes to mind is to shoot Raycast to mouseLoc on rightClick (see ScreenPointToRay) and see if it hits something/nothing/enemy
If it hits enemy, use Vector3.Distance to see if it's in Range and if so - voila/play Anim