Pickable

Overview

This component allows a character to pick and dropped an object. It works directly with the PickUp-Drop component.

Requirements

Collider

It requires any type of collider(s). This collider must NOT be set as a trigger.

Rigidbody (Optional)

If the pickable object has a RigidBody attached, then it can interact with the environment when is dropped.

How it works

When the character approaches a pickable object, using the PickUp Trigger, it will set as focused a Pickable on the PickUp component. Then the PickUp component will have access to all the pickable properties to act accordingly. So you can Pick or Drop an Item:

You can assign any Input to the Main Methods of the Pick Up Component <TryPickUpDrop()> These logics will be applied and it will Pick the Item, or drop it if it already has it.

Parameters

ID

Int value the Pickable Item can store. This ID is used by the Picker component to Identify each Pickable Object.

Float Value

Float value the Pickable Item can store.. that it can be used for anything

Auto

The Item will be Picked Automatically once is focused by the PickUp Component

UseAnimation

The Pick Up Drop Logic will be called via animator events/messages. Use these methods: TryPick(), TryDrop(), TryPickUpDrop()

SceneRoot

Unparent the Pickable, so it does not have any Transform parents.

Collectable

When an Object is Collectable it means that the Picker can still pick objects, the item will be collected by another component (E.g. Weapons or Inventory) and it will no longer be an Active Item on the Pick Up Component

Destroy On Pick

The Item will be destroyed after is picked. (This Option is only Enabled when Collectable is On

RigidBody

Reference for the Pickable RigidBody

Colliders

All colliders the Pickable may have

CoolDown

The time needed to Pick up the item once it was dropped. OR The time needed to Drop the item once it was picked up.

Pick Delay

Delay time after calling the Pick() method. the item will be parented to the PickUp component after this time has passed

Drop Delay

Delay time after calling the Drop() method. the item will be unparented from the PickUp component after this time has passed

AlignOnPick

This will align the Character to the Pickable Component. It will Rotate the Animal Towards the Item.

AlingPos

If set to true, It will also move the character to a radius near the item, using the Distance parameter

Distance

Distance or Radius to align the character so it can pick the pickable

Align Time

Aligning time to move the character to the correct position for picking the object

Events

OnFocused<Bool>

Invoked when the Item is focused by a PickUp-Drop Component. Sends true or false if it is focused or not

OnFocusedBy<GameObject>

Invoked when the Item is focused by a PickUp-Drop Component. Sends the PickUp GameObject if is focused or Null if is not

OnPicked<GameObject>

Invoked when the Item is Picked by a PickUp-Drop Component. Sends the PickUp GameObject

OnPrePicked<GameObject>

Invoked when the Item is Pre-Picked by a PickUp-Drop Component. Meaning the Item is about to be picked up after the Delay Pick time has passed. Sends the PickUp GameObject

OnDropped<GameObject>

Invoked when the Item is Dropped by a PickUp-Drop Component. Sends the PickUp GameObject

OnPreDropped<GameObject>

Invoked when the Item is Pre-Dropped by a PickUp-Drop Component. Meaning the Item is about to be picked up after the Delay Pick time has passed. Sends the PickUp GameObject

Last updated