Saturday, February 9, 2013

NavTac - Log #5

Well, it's almost 3 in the morning, and I finally have shooting done. After playing with lots of methods to get the shells to follow a certain arching trajectory, both by tweening/lerping and use of physics, I ended up finding a very helpful script someone posted on Unity Answers and was able to tweak it to my needs, implementing it into my overall turret-control script.

For the record, this is the Answers page.

So now the turret is able to track its target and shoot it with the script I've written, which I've made it to allow me to set via the Inspector:

  1. The ammo/shell prefab
  2. Maximum firing range
  3. Reload time
  4. Amount of shots to begin with
  5. Rotation damping factor for the turret
  6. And the maximum and minimum elevation angles for the turret
I think the last thing I need to do now is attempt to calculate the lead for the target. I found a script the other day meant for that purpose, hopefully I'll have luck figuring it out and including it quickly. I'll post a new webplayer with my next log.


No comments:

Post a Comment