29th March 2022 – Shooting Mechanic

Here, I made a placeholder gun and bullet which will be used for the shooting mechanic which I quickly made out of cubes and a squashed sphere.

This part of the code is me setting up each of the variables that I need for the gun to work. The transforms are for aiming the gun so when you hold the right mouse button, it will zoom in.

This part of the code shows the aiming process and how the gun will shoot the bullet. The shooting part is instantiating the bullet prefab I created and is putting its position at the spawn for the bullets position and setting the bullets velocity to a set speed.

I also added a close-up shot which will be used for aiming the gun with the right mouse button when I get the proper animation for it.

search previous next tag category expand menu location phone mail time cart zoom edit close