ActorUnreal
Inheritance diagram
- class xrfeitoria.actor.actor_unreal.ActorUnreal(name: str)[source]
Actor class for Unreal Engine.
- __init__(name: str) None
- Parameters:
name (str) – name of the object
- delete()
Delete the object from the world.
- get_transform() Tuple[List, List, List]
Get the transform of the object in the world.
- Returns:
Transform – location, rotation, scale
- classmethod import_from_file(file_path: str | Path, actor_name: str | None = None, location: Tuple[float, float, float] | None = None, rotation: Tuple[float, float, float] | None = None, scale: Tuple[float, float, float] | None = None, stencil_value: int = 1) ActorBase
Imports an actor from a file and returns its corresponding actor.
For Blender, support files in types: fbx, obj, abc, ply, stl.
Note
For fbx file, Blender only support binary format. ASCII format is not supported. (Ref)
- Parameters:
path (PathLike) – the path to the actor file.
name (str, optional) – the name of the actor. Defaults to None.
location (Vector, optional) – the location of the actor. Defaults to None. unit: meter
rotation (Vector, optional) – the rotation of the actor. Defaults to None. unit: degree
scale (Vector, optional) – the scale of the actor. Defaults to None.
stencil_value (int in [0, 255], optional) – Stencil value of the actor. Defaults to 1. Ref to What is stencil_value for details.
- Returns:
ActorBase – the actor object.
- set_transform(location: Tuple[float, float, float], rotation: Tuple[float, float, float], scale: Tuple[float, float, float]) None
Set the transform of the object in the world.
- Parameters:
location (Tuple[float, float, float]) – in meters
rotation (Tuple[float, float, float]) – in degrees
scale (Tuple[float, float, float]) – no units, 1.0 is default
- setup_animation(animation_path: str | Path, action_name: str | None = None) None
Load an animation from a file and setup for the actor.
For Blender, support files in types: fbx, blend, json.
Note
For fbx file, Blender only support binary format. ASCII format is not supported. (Ref)
- classmethod spawn_from_engine_path(engine_path: str, name: str | None = None, location: Tuple[float, float, float] = (0, 0, 0), rotation: Tuple[float, float, float] = (0, 0, 0), scale: Tuple[float, float, float] = (1, 1, 1)) ActorBase [source]
Spawns an actor in the engine and returns its corresponding actor.
- Parameters:
engine_path (str) – the path to the actor in the engine. For example, ‘/Game/Engine/BasicShapes/Cube’.
name (str, optional) – the name of the actor. Defaults to None, in which case a name will be generated.
location (Vector, optional) – the location of the actor. Units are in meters. Defaults to (0, 0, 0).
rotation (Vector, optional) – the rotation of the actor. Units are in degrees. Defaults to (0, 0, 0).
scale (Vector, optional) – the scale of the actor. Defaults to (1, 1, 1).
- Returns:
ActorBase – the actor that was spawned
- property bound_box: Tuple[Tuple[float, float, float], Tuple[float, float, float]]
Bounding box of the actor in the world space.
- property dimensions: Tuple[float, float, float]
Dimensions of the actor in the world space.
- property engine_path: str
Engine path of the actor.
- property location: Tuple[float, float, float]
Location of the object in the world, in meters.
- property mask_color: Tuple[float, float, float]
Get the mask color of the actor.
RGB values (int) in [0, 255].
- property name: str
Name of the object.
- property rotation: Tuple[float, float, float]
Rotation of the object in the world, in degrees.
- property scale: Tuple[float, float, float]
Scale of the object in the world, no units, 1.0 is default.
- property stencil_value: int
Get the stencil value of the actor.