-
Notifications
You must be signed in to change notification settings - Fork 94
[Depreciated] World Interaction (Basic Pickupable Blueprint)
##Creating a Custom Pickup-able Sphere
Static Mesh actors will automatically be able to be picked up by the Interactor component if you would like to pickup a custom blueprint this is a way of doing it. We will assume that you already have a Pawn blueprint with the World Interactor component implemented.
###The Pickup-able Blueprint
First we are going to setup a new blueprint to do so create a new "Actor" blueprint and name it whatever you need.
- Add a new "Sphere" component this will be the mesh we are going to pick up
- Set the sphere's scale to something reasonable
Next we're going to add the interfaces to allow the object to be interacted with
- Open the class settings
- Add the "Pickupable" Interface and the "World Interactable" Interface this will allow the object to be picked up and interacted with by an Interactor component
Next we can setup the snapping as needed
- Open the "ShouldSnapToInteractor" function
- Leave the "Snap" output as false this is what you would change if you would like the object to snap to the Interactor
By default the object is attached to the Interactor on pickup when the "Pickupable" interface is given to a blueprint. To drop the object we're going to enable physics on the sphere when the object is dropped. To make sure we can pickup the object once we have dropped it we should disable physics when we pickup the object.
Note: when the component we enable physics on is not the Root component it will be disconnected from the object, that means that when we go to pickup the object again we cannot attach the component to the Interactor. To fix this we need to re-attach the sphere to the root component of our object when we pick it up
Note: Here the Location, Rotation and Scale rule is set to "Keep World", if we enable the "SnapToInteractor" variable we would need to set these to "Snap To Target"
And that's it, that's a basic pickup-able object.
You will notice that it does not respond to collision if you are looking for one workaround for that check out the Drop Overlap Tutorial.
For another extension we can override the drop event when we pickup the object, to do this check out the Overriding Pickup-able event tutorial.
-Mitch