ActorBase
Inheritance diagram
- class xrfeitoria.actor.actor_base.ActorBase(name: str)[source]
Base class for all actors in the world.
- __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 [source]
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 [source]
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)
- 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 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.