unreal.SmartObjectSubsystem¶
- class unreal.SmartObjectSubsystem(outer: Optional[Object] = None, name: Union[Name, str] = 'None')¶
Bases:
WorldSubsystemSubsystem that holds all registered smart object instances and offers the API for spatial queries and reservations.
C++ Source:
Plugin: SmartObjects
Module: SmartObjectsModule
File: SmartObjectSubsystem.h
- add_tag_to_instance(handle, tag) None¶
Adds a single tag to the smart object instance represented by the provided handle.
- Parameters:
handle (SmartObjectHandle) – Handle to the smart object.
tag (GameplayTag) – Tag to add to the smart object instance.
- claim(request_result) SmartObjectClaimHandle¶
Claims smart object from a request result.
- Parameters:
request_result (SmartObjectRequestResult) – Request result for given smart object and slot index.
- Returns:
A handle binding the claimed smart object, its slot and a user id.
- Return type:
- find_smart_object(request) SmartObjectRequestResult¶
Spatial lookup
- Parameters:
request (SmartObjectRequest) –
- Returns:
First valid smart object in range. Not the closest one, just the one that happens to be retrieved first from space partition
- Return type:
- find_smart_objects(request) Array[SmartObjectRequestResult] or None¶
Spatial lookup
- Parameters:
request (SmartObjectRequest) –
- Returns:
All valid smart objects in range.
out_results (Array[SmartObjectRequestResult]):
- Return type:
Array[SmartObjectRequestResult] or None
- get_behavior_definition(claim_handle, definition_class) SmartObjectBehaviorDefinition¶
Return the behavior definition of a given type from a claimed object.
- Parameters:
claim_handle (SmartObjectClaimHandle) – Handle to a claimed slot returned by any of the Claim methods.
definition_class (type(Class)) – The type of behavior definition.
- Returns:
The base class pointer of the requested behavior definition class associated to the slotClaim handle
- Return type:
- get_behavior_definition_by_request_result(request_result, definition_class) SmartObjectBehaviorDefinition¶
Return the behavior definition of a given type from a request result.
- Parameters:
request_result (SmartObjectRequestResult) – A request result returned by any of the Find methods.
definition_class (type(Class)) – The type of behavior definition.
- Returns:
The base class pointer of the requested behavior definition class associated to the request result
- Return type:
- get_instance_tags(handle) GameplayTagContainer¶
Returns the list of tags associated to the smart object instance represented by the provided handle.
- Parameters:
handle (SmartObjectHandle) – Handle to the smart object.
- Returns:
Container of tags associated to the smart object instance.
- Return type:
- get_slot_location(claim_handle) Vector or None¶
Returns the position (in world space) of the slot associated to the given claim handle.
- Parameters:
claim_handle (SmartObjectClaimHandle) – Handle to a claimed slot returned by any of the Claim methods.
- Returns:
Whether the location was found and assigned to ‘OutSlotLocation’
out_slot_location (Vector): Position (in world space) of the slot associated to ClaimHandle.
- Return type:
Vector or None
- get_slot_transform(claim_handle) Transform or None¶
Returns the transform (in world space) of the slot associated to the given claim handle.
- Parameters:
claim_handle (SmartObjectClaimHandle) – Handle to a claimed slot returned by any of the Claim methods.
- Returns:
Whether the transform was found and assigned to ‘OutSlotTransform’
out_slot_transform (Transform): Transform (in world space) of the slot associated to ClaimHandle.
- Return type:
Transform or None
- get_slot_transform_from_request_result(request_result) Transform or None¶
Returns the transform (in world space) of the slot associated to the given RequestResult.
- Parameters:
request_result (SmartObjectRequestResult) – Result returned by any of the Find Smart Object(s) methods.
- Returns:
Whether the transform was found and assigned to ‘OutSlotTransform’
out_slot_transform (Transform): Transform (in world space) of the slot associated to the RequestResult.
- Return type:
Transform or None
- get_smart_object_component(claim_handle) SmartObjectComponent¶
Returns the component associated to the claim handle if still accessible. In some scenarios the component may no longer exist but its smart object data could (e.g. streaming)
- Parameters:
claim_handle (SmartObjectClaimHandle) – Handle to a claimed slot returned by any of the Claim methods.
- Returns:
A pointer to the USmartObjectComponent* associated to the handle.
- Return type:
- get_smart_object_component_by_request_result(result) SmartObjectComponent¶
Returns the component associated to the given request result In some scenarios the component may no longer exist but its smart object data could (e.g. streaming)
- Parameters:
result (SmartObjectRequestResult) – A request result returned by any of the Find methods .
- Returns:
A pointer to the USmartObjectComponent* associated to the handle.
- Return type:
- release(claim_handle) bool¶
Release claim on a smart object.
- Parameters:
claim_handle (SmartObjectClaimHandle) – Handle to a claimed slot returned by any of the Claim methods.
- Returns:
Whether the claim was successfully released or not
- Return type:
- remove_tag_from_instance(handle, tag) None¶
Removes a single tag from the smartobject instance represented by the provided handle.
- Parameters:
handle (SmartObjectHandle) – Handle to the smart object.
tag (GameplayTag) – Tag to remove from the SmartObject instance.
- use(claim_handle, definition_class) SmartObjectBehaviorDefinition¶
Start using a claimed smart object slot.
- Parameters:
claim_handle (SmartObjectClaimHandle) – Handle to a claimed slot returned by any of the Claim methods.
definition_class (type(Class)) – The type of behavior definition the user wants to use.
- Returns:
The base class pointer of the requested behavior definition class associated to the slot
- Return type: