Bow and arrow with UCC and UIS

Hi,

I am trying to integration a bow and arrow with UIS. I have created both in the database as Single item. So they have a prefab bow and a prefab arrow. As arrow must be displayed with the bow and it is also a projectile I am not sure about the setup. I think relevant to be able to have arrows in the inventory but I don't know if it should be also an equipable item as it is a projectile also. I started in this way as it must be visible and spawned in the right hand in Arrow Attachment in the rig. In the demo of UCC that is not integrated with UIS, the fire point is moved at the runtime in the Arrow Attachment of the character. This arrow attachment has a component Object identifier with ID=4 like the bow.

I have a pickup bow that I have adapted for UIS. It is basically the same that the UCC demo that means a bow gameobject with:
- Inventory component with 1 bow in itemCollection that comes from the database,
- Inventory Pickup Item component with a bow definition in slot 1 (left hand) for item pickup set (gameobject is empty)
- A sphere collider like in the demo integration between UCC and UIS
- As child a bow model that has 2 children a Bow skinned mesh renderer and an armature but disabled as it is not required for picking up.

I have also in project 3 prefabs:
1- ThirdPersonControllerBow:
- Item component with bow Item definition and
- drop prefab that is ThirdPersonControllerBowPickup,
- Third Person Perspective Item with the Third Person Bow with skinned mesh renderer and armature and Fire Point inside the armature in "String" level.
- Shootable Weapon component with Firing Consumable Item Definition Arrow and projectile that is a prefab Arrow
- Third Person Shootable Perspective Weapon properties with the fire point location pointing on the firepoint in armature
- ItemObject component for 1 bow
2- ThirdPersonControllerBowPickup:
- Inventory component with 1 bow in ItemCollection
- InventoryItemPickup with 1 bow in Item pickup set with Category equippable and slot 1 = Bow
- Trajectory Object component to have the object be able to fall on the ground when dropping it
- SphereCollider
3- Arrow:
- Mesh Arrow
- Capsule Collider
- Rigidbody
- Trail Renderer
- Surface Identifier
- Projectile
- Item:
- ItemObject component with 1 arrow
- Third Person Object component

My bow is correctly spawned in the left hand of my character but the arrow is not! The arrow is not visible in the right hand and the arrow attachment is still empty.
I have had an error message with null reference then I have added Item as it is required in the Ultimate Inventory System Bridge. And the error has been fixed but later in the code the third perspective is always empty (m_ActivePerspectiveItem = null in loop ) that why I have added also Third Person Object component but without success (well I know that is not really logical but after spending hours trying lot of things we come to do anything!).

I think that I should not use Arrow as a projectile and also as an item. But I should use 2 different objects to setup correctly:
- 1 arrow for the projectile that is only a mesh
- 1 arrow item with item component: but for this item I don't know what the data should be: Item Definition with Arrow I suppose but I lost with Animator Item ID and Animator Movement Set ID. It should not be filled in I think as the arrow is not part of animator!
- What should be the preferable the item definition for my arrow? consumable makes sense but that means that prefab for arrow it not required at all. It might be the way. I am confused.

Could you emphasize what is correct in my approach and what is not and what I should try to success ?

Configuration:
UCC 2.2.7
UIS 1.1.3
Unity 2019.4.16f1
 
Last edited:
The arrow should be set as a projectile.

Make sure to watch this video tutorial:

you can set the position of the arrow at runtime using an Object Identifier

Check the UCC demo scene it uses a runtime pickup for bow and arrow. It should help you setup your own.
 
I have changed my mind and I made the arrow a consumable in database. In this way, there is no need to have an equippable prefab for the arrow.

The Fire point location was also baddly setup with ID=4 that is the ID that identified the Left Leg for Body! I have assigned another ID = 5 and I have changed in Third Person Shootable Weapon Properties component of ThirdPersonControllerBow the Fire Point Attachment Location ID accordingluy to 5. Like this the arrow is correctly spawned in Arrow Attachment.
 
It works fine now. It was quite difficult to position bow and arrow. But it is ok. Maybe be something to do with animation that seems blocks something. I will refine and it should go.
 
Top