Expanding Project
Adding new weapon
- Create a new prefab or duplicate an existing weapon. 
- Make sure that there is at least one - WeaponActioncomponent and appropriate weapon components on the prefab.- WeaponActionand weapon components can be all on one- GameObject(see- Sniperprefab) or in case of multiple weapon actions it needs to be placed in hierarchy (see- Rifleprefab).
- Set the - WeaponSlotin the- Weaponcomponent to specify which place it should occupy in the player weapons array.
- Optionally assign weapon name and icon in the - Weaponcomponent.
- Assign weapon to - Initial Weaponsfield in the- Weaponscomponent on the- PlayerAgentprefab.
 
Adding new projectile
- Create a new prefab or duplicate existing projectile. Make sure there is a component that inherits from - Projectile.
- Assign projectile prefab to weapon prefab in - WeaponBarrelcomponent.
 
- Assign projectile prefab in the HitscanProjectileBufferorKinematicProjectileBufferon the controlling object (e.g. thePlayerAgentprefab) to make sure it will spawn the projectile when fired.
Switch to third person
Fusion Projectiles is built as an FPS game but most of the functionality applies for TPS games as well. When firing in TPS games, first a ray needs to be cast from the camera to find the point at which the player is trying to shoot. The actual projectile cast will then be from a position on character (fixed position near character shoulder usually works well) to the point obtained from the camera cast. There are usually some tricks (like ignoring some collisions with second cast) involved so players won’t be hitting unwanted objects too much (corners issue). Check out Fusion BR for a TPS handling example.
Back to top