I’m trying to create a small prototype, where some Mass Entities wander around a ZoneGraph path, and occasionally interact with a Smart Object if one is available.
The AI is driven by StateTree, which has some prebuilt Tasks for working with Smart Objects.
My main issue is, I can’t get the Find SmartObject Task to actually find any objects. By looking at the source code, I can tell the task does some ZoneGraph based query, where it tries to find a SmartObject accessible through the ZoneGraph path the Entity is currently on, but it always returns 0 results when looking at it through the Visual Logger.
For the Smart Object, I tried both using the Generic Smart Object actor that comes prebuilt with the plugin, and a custom one. I added a SmartObject component and a SmartObject Zone Annotation component, setting the Affected lane to the one used by the Path (a tag I named ‘Pedestrian’), and setting the Behavior Tag to a custom ‘SmartObject’ tag. In Project Settings, in the Mass > MassSmartObject section, I set the SmartObject tag to the one I created, and toyed around with different values for the query radius, but no luck.
The SmartObject is using a Smart Object Mass Behavior Definition on all Slots, and it is getting recognized by Mass since it’s creating an Entity for each Slot (but no Entity for the object itself, tho I don’t think that’s needed).
I’ve tried looking at the CitySample Unreal released but can’t find anything they’re doing that I’m not.
Has anyone had any luck doing something like this?
Coming with some update. I found the issue maybe can help.
I need to place a SmartObjectPersistentCollection actor in the level and check in the SmartObject component of the actor : “Can be Part Of Collection”.
Then if you select back the Smart Object Persistent Collection placed in the level you can rebuild and the smart object should appears.
I don’t know why the smart object is not able to register itself at runtime. Maybe @James.Keeling you have an idea ?
Because in case we would like to register smart objects at runtime, the persistent collection would not fit
To follow up on @TheArrow20’s post, checking “Can be part of collection” worked for me as well - the Find Smart Object Task finds the SO handle if it’s within the radius. I didn’t have to add a Smart Object Persistent Collection actor though - not sure why or if I’ll need to later.
Debugging the engine, I found the specific problem is without allowing the SO to be added to a collection the SO will have a new handle assigned at runtime that won’t match the handles in the Smart Object Zone Annotation. I’m curious what the impact of allowing that is, since it is false by default.