Outlined Pickup Object
Last updated
Last updated
As the foundation for the project, ALS is used. Additionally, it is necessary to choose any ready-made solution (or create your own) for outlining objects.
First, let's create a 3D widget for our interactive objects. For the basis, I took the default widget from the plugin content of this plugin - WBP_InteractionPanel
Simply make a copy of it. Then, implement the logic as shown in the screenshot below.
Here we simply cache the character interaction component, then in the tick we check if the current BestObjectToUse is equal to this object (which we get through the widget's outer), then the widget changes color, and also the progress bar is filled based on the value of DelayedObjectProgress.
Next, create a base actor for the interactive object - BP_PickableActor.
Add to it the CISInteractionObject component, as well as the CISWidget component - this is the same type of widget component as the default one, but with one difference - the outer of the created widget is assigned to the owner of this component, i.e., the BP_PickableActor itself.
Also, you will need to create a new CISInteractionObjectAction + another CISInteractionDataObject to handle the outline change. You can name them BP_PickupAction and BP_PickableDataObject, respectively.
The CISInteractionObject settings are as follows:
I simply added one InteractionSide with a 360-degree radius, assigned to it the previously created PickupAction, as well as designated the DataObjectClass.
The logic in BP_PickupAction consists of the following sequence:
Here we simply change the animation state in the ALS character, complete the action, and destroy the interactive object actor.
And the final part - let's take a look at the BP_PickableDataObject settings.
Upon initialization, we subscribe to changes in the current BestObjectForUse - this is necessary so that the outline works only on the potential object for interaction and is turned off for all others.
Then in the UpdateOutline function, provided that the current object for use is equal to BestObjectForUse, we enable or disable the outline effect.
Also, when changing the Usable state of the object, we turn the CISWidget component on or off.
Thus, you can create basic objects for interactions for your game.
I chose this plugin -
Настройки CISWidgetComponent