PlayerShootingState impementation Course recommendations

Hi All,

I’ve finished the Unity 3rd person course and I’d like to continue by implementing a 3rd person shooting mechanic expanding on the state machine from the lectures to allow me to add multiple weapons and projectile types in future.

Does Gamedev.tv have a good course for this type of thing, I’ve been struggling to find one that implements shooting and isn’t a turn based game?

We do implement shooting in the RPG course. It’s not in the form of a StateMachine, as Sam chose to go stateless (psuedo stateless)
In terms of the Third Person course, I can give you a few helpful hints:

  • The weapon will need a point on it that can be considered “forward”, pointing towards the target.
  • You’ll spawn the projectile at the weapon’s spawnpoint with a position and direction equal to the weapon’s spawn point’s transform
  • You’ll want to do this at the percent in the animation where that weapon’s forward is pointing… well… forward
  • If you’re in PlayerFreelookState, good luck, hope that arrow finds something.
  • If you’re in PlayerTargetingState, the arrow should be pointing correclty at the enemy already.
  • The projectile, if it hits anything in OnTriggerEnter() that’s not belonging to the owner, should check to see if that thing has a Health component and damage it if it does. Either way, whether it hit a health or not, it’s done, the projectile should stop/be destroyed.

Also, the Turn Based Strategy Course has a Shoot Action that has a small state machine to handle some form of aiming and shooting. If you understood the Traversal and Combat course’s material it shouldn’t be too hard to adapt that.

1 Like

Privacy & Terms