Posted April 26, 2024 by Pixel Pulse Studio
Welcome! this part of the project was something a bit more challenging than I anticipated this to be. At first since I want to track the closest racer and the players car was counting as the closest car but that was the least of my worries. Tracking the enemy with my weapon made it simple until, I challenged myself to calculate and predict where to aim so when we decide to use our weapon the projectile will essentially hit the target.
The way I decided to kinda calculate this is ask myself how long would it take for my projectile to hit the targets current position from how far it is and how fast my projectile is. I then just proceeded to just make my prediction equals the current (target’s position + target’s velocity * target’s magnitude * how long the bullet takes to hit the target). Although this is a simple calculation it isn’t too efficient yet.. because I still have many things to consider like the input of the racer, if its going to accelerate any more and how much, if we can shoot ahead, etc. Thank you for tunning in! :)
Published By: Christian Camargo-Cortez Date: 4/26/2024