Hello my name is Carter from gold moon studio. My role here is the gameplay programmer, I primarily handle the creation of the player, cockpit, and mech controlled by the player.
One of the most time-consuming tasks for this week was player weaponry. Naturally this part of the game is still very simplistic as we are only a month into development. The hardest part of the weapons had be the aiming the weapon. The weapon was not a part of the player it was a part of the mech that was controlled with virtual joysticks. The problem stemmed from making the guns align with and shoot towards, the crosshair. The guns would often point at the ground and rotating them all the way behind you vertically was also possible
I later solved it by doing a few things. One was rotating not only the weapons themselves to face the reticle but also the muzzle transforms that were placed onto them. I also had to have both arms parented under the same transform to facilitate their rotation with the camera. I also realized that having them look at a transform was not the way to go, because the transform could very well be at the bottom of an object while im looking at its top. I instead replaced the transform with a vector 3 that was found by raycasting from the camera.
This gave me weapons that would properly aim themselves where i looked while also truly firing from the barrel and not the player
Did you like this post? Tell us
Leave a comment
Log in with your itch.io account to leave a comment.