from tdw.add_ons.third_person_camera_base import ThirdPersonCameraBase
An abstract base class for third-person camera controller add-ons.
Variable | Type | Description | Value |
---|---|---|---|
RENDER_ORDER |
int | The render order. Third person cameras will always render "on top" of any other cameras. | 100 |
-
avatar_id
The ID of the avatar that (this camera). -
position
The position of the camera. If None, defaults to{"x": 0, "y": 0, "z": 0}
. -
commands
These commands will be appended to the commands of the nextcommunicate()
call. -
initialized
If True, this module has been initialized.
ThirdPersonCameraBase()
ThirdPersonCameraBase(avatar_id=None, position=None, rotation=None, field_of_view=None)
Parameter | Type | Default | Description |
---|---|---|---|
avatar_id | str | None | The ID of the avatar (camera). If None, a random ID is generated. |
position | Dict[str, float] | None | The initial position of the camera. If None, defaults to {"x": 0, "y": 0, "z": 0} . |
rotation | Dict[str, float] | None | The initial rotation of the camera. Can be Euler angles (keys are (x, y, z) ) or a quaternion (keys are (x, y, z, w) ). If None, defaults to {"x": 0, "y": 0, "z": 0} . |
field_of_view | int | None | If not None, set the field of view. |
self.get_initialization_commands()
This function gets called exactly once per add-on. To re-initialize, set self.initialized = False
.
Returns: A list of commands that will initialize this add-on.
self.on_send(resp)
This is called after commands are sent to the build and a response is received.
Use this function to send commands to the build on the next frame, given the resp
response.
Any commands in the self.commands
list will be sent on the next frame.
Parameter | Type | Default | Description |
---|---|---|---|
resp | List[bytes] | The response from the build. |
self.before_send(commands)
This is called before sending commands to the build. By default, this function doesn't do anything.
Parameter | Type | Default | Description |
---|---|---|---|
commands | List[dict] | The commands that are about to be sent to the build. |
self.get_early_initialization_commands()
This function gets called exactly once per add-on. To re-initialize, set self.initialized = False
.
These commands are added to the list being sent on communicate()
before any other commands, including those added by the user and by other add-ons.
Usually, you shouldn't override this function. It is useful for a small number of add-ons, such as loading screens, which should initialize before anything else.
Returns: A list of commands that will initialize this add-on.