Please help with Shoot Action Accuracy

Hi,

Wondering if someone could help me with XCOM style shoot accuracy.
As seen in this video: [www.youtube.com/watch?v=ezlkGhFBrmg&t](https://I made XCOM in 25 HOURS! by CodeMonkey)

Got the scripts www.unitycodemonkey.com/video.php?v=ezlkGhFBrmg

I just can’t get my head around intigrated it into my project after the refractoring. All the variables have different names and I’m lost.

Anyone willing to share a working Shoot Action script with me so I can see?
Thanks!

Messed up the formatting a bit. Oops.
But I think it still works.

You might check out the repo from the finished course:

What specific feature are you trying to implement?
That original video was the initial prototype which is quite a lot different from the final code in the course, so you can’t just copy paste it, quite a bit of the project structure is different.
Are you trying to add some kind of miss chance? Calculating that is just some basic math but depends on what elements you want to include in the calculation.
The simplest one is just distance to the target, you can get the distance between the Vector3s and apply a accuracy penalty if it goes past a certain distance.
Then on the ShootAction you can calculate to decide if the attack should damage or not

1 Like

Exactly yeah.
Just think I’m a little confused after the refactoring.
I’ll try again today.

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.

Privacy & Terms