Throwable Item (Grenades)

It seems creating grenades is quite different from shootable and melee weapons. Do you plan on creating a video at some point?
So far, I can equip and throw my grenades, but they do not explode, and I also then can not unequip them. I get an error in the console about requiring a Trajectory component, but it does have one as far as I can see...

Not sure if it is referring to the actual item, or the third person item that is a child of the character's hand. I'm also not clear about the use of an object that is a consumable item, and the difference in the "thrown object" and the third person object. It's a little confusing, also in the manual it states this is how the primary and secondary grenade are connected.

So yeah, a tutorial on this would be very helpful (unless there is one?).
 
Okay, so the trajectory object component has to be applied to the thrown object prefab, so that's solved.

However, my grenade is not exploding though, and I get an error about item use:

NullReferenceException: Object reference not set to an instance of an object
Opsive.UltimateCharacterController.Items.Actions.GrenadeItem.StartItemUse () (at Assets/Opsive/UltimateCharacterController/Scripts/Items/Actions/GrenadeItem.cs:44)
Opsive.UltimateCharacterController.Character.Abilities.Items.Use.AbilityStarted () (at Assets/Opsive/UltimateCharacterController/Scripts/Character/Abilities/Items/Use.cs:457)
Opsive.UltimateCharacterController.Character.Abilities.Ability.StartAbility (System.Int32 index) (at Assets/Opsive/UltimateCharacterController/Scripts/Character/Abilities/Ability.cs:434)
Opsive.UltimateCharacterController.Character.UltimateCharacterLocomotion.TryStartAbility (Opsive.UltimateCharacterController.Character.Abilities.Items.ItemAbility itemAbility, System.Boolean ignoreCanStartCheck) (at Assets/Opsive/UltimateCharacterController/Scripts/Character/UltimateCharacterLocomotion.cs:1245)
Opsive.UltimateCharacterController.Character.UltimateCharacterLocomotion.TryStartAbility (Opsive.UltimateCharacterController.Character.Abilities.Ability ability, System.Boolean ignorePriority, System.Boolean ignoreCanStartCheck) (at Assets/Opsive/UltimateCharacterController/Scripts/Character/UltimateCharacterLocomotion.cs:1037)
Opsive.UltimateCharacterController.Character.UltimateCharacterLocomotion.TryStartAbility (Opsive.UltimateCharacterController.Character.Abilities.Ability ability, System.Boolean ignorePriority) (at Assets/Opsive/UltimateCharacterController/Scripts/Character/UltimateCharacterLocomotion.cs:1023)
Opsive.UltimateCharacterController.Character.UltimateCharacterLocomotion.TryStartAbility (Opsive.UltimateCharacterController.Character.Abilities.Ability ability) (at Assets/Opsive/UltimateCharacterController/Scripts/Character/UltimateCharacterLocomotion.cs:1012)
Opsive.UltimateCharacterController.Character.UltimateCharacterLocomotionHandler.TryStartAbility (Opsive.UltimateCharacterController.Character.Abilities.Ability ability) (at Assets/Opsive/UltimateCharacterController/Scripts/Character/UltimateCharacterLocomotionHandler.cs:231)
Opsive.UltimateCharacterController.Character.UltimateCharacterLocomotionHandler.UpdateAbilityInput (Opsive.UltimateCharacterController.Character.Abilities.Ability[] abilities) (at Assets/Opsive/UltimateCharacterController/Scripts/Character/UltimateCharacterLocomotionHandler.cs:128)
Opsive.UltimateCharacterController.Character.UltimateCharacterLocomotionHandler.UpdateAbilityInput () (at Assets/Opsive/UltimateCharacterController/Scripts/Character/UltimateCharacterLocomotionHandler.cs:99)
Opsive.UltimateCharacterController.Character.UltimateCharacterLocomotionHandler.Update () (at Assets/Opsive/UltimateCharacterController/Scripts/Character/UltimateCharacterLocomotionHandler.cs:73)


It's probably a small mistake I've overlooked somewhere, but where?



EDIT: Actually, it seems the Trajectory Object goes on the item pickup prefab (not sure why yet), and the grenade script goes on the thrown object
(seems kinda obvious now ?).
 
Last edited:
Top