Repository navigation
API Camera
from proleak import cameraRead the game camera; moving it, and riding a unit in first person, needs the actions capability (local games only).
| Class | Description |
|---|---|
CameraDict |
The game camera as get gives it. |
Pov |
A unit view from pov or third_person. |
| Returns | Function | Description |
|---|---|---|
CameraDict |
get() |
Where the game camera is and where it looks. |
None |
set(x: float | None = None, y: float | None = None, z: float | None = None, yaw: float | None = None, pitch: float | None = None, fov: float | None = None) |
Move or turn the camera; omitted values stay as they are. |
None |
focus_unit(unit_id: int) |
Center the camera on a unit. |
None |
reset() |
Return the camera to the game's default. |
Pov |
pov(unit: Unit | int, offset: tuple[float, float, float] = (0.0, 0.0, 0.0), pitch: float = 0.0, show_unit: bool = False, look: tuple[float, float] | None = None) |
Ride unit in first person; returns a Pov. |
Pov |
third_person(unit: Unit | int, distance: float = 6.0, yaw: float | None = None, pitch: float = 25.0, show_unit: bool = True, orbit: bool = True) |
Follow unit from behind and above; returns a Pov. |
def get() -> CameraDictWhere the game camera is and where it looks.
set(x, y, z, yaw, pitch, fov) -> None
def set(
x: float | None = None,
y: float | None = None,
z: float | None = None,
yaw: float | None = None,
pitch: float | None = None,
fov: float | None = None,
) -> None| Argument | Type | Default | Description |
|---|---|---|---|
x |
float | None |
None |
The map x to move to. |
y |
float | None |
None |
The height to move to. |
z |
float | None |
None |
The map z to move to. |
yaw |
float | None |
None |
The direction to face, in degrees (Unity's convention: 0 looks along +z). |
pitch |
float | None |
None |
How far to look down, in degrees. |
fov |
float | None |
None |
The vertical field of view, in degrees. |
Move or turn the camera; omitted values stay as they are.
focus_unit(unit_id) -> None
def focus_unit(unit_id: int) -> None| Argument | Type | Default | Description |
|---|---|---|---|
unit_id |
int |
required | The unit's id. |
Center the camera on a unit.
def reset() -> NoneReturn the camera to the game's default.
pov(unit, offset, pitch, show_unit, look) -> Pov
def pov(
unit: Unit | int,
offset: tuple[float, float, float] = (0.0, 0.0, 0.0),
pitch: float = 0.0,
show_unit: bool = False,
look: tuple[float, float] | None = None,
) -> Pov| Argument | Type | Default | Description |
|---|---|---|---|
unit |
Unit | int |
required | The unit, as a Unit or its id. |
offset |
tuple[float, float, float] |
(0.0, 0.0, 0.0) |
Moves the camera from the unit's head, as (right, up, forward) in the unit's own frame and in world units. |
pitch |
float |
0.0 |
How far the camera looks down from where the unit faces, in degrees. |
show_unit |
bool |
False |
Whether the unit's model stays visible. |
look |
tuple[float, float] | None |
None |
Lets the player look around within (horizontal, vertical) degrees, at most 180 each (90 is 45 each way, 0 turns an axis off). None: the view stays fixed. |
Ride unit in first person; returns a Pov.
The camera sits at the unit's head (or the top of its model when it has no head point),
moved by offset, and looks where the unit faces, pitch degrees down. The unit's health
bar is hidden while the view lasts, and ground rings lie flat. A placed fighter hidden during
a wave is followed through the unit that fights for it. With look, the player looks around
by dragging with the middle mouse button.
One plugin holds the view at a time: calling again (or calling third_person) from the same plugin moves the view to the new unit, from another plugin raises ValueError. The view ends with end, when its unit leaves the game, or when the plugin unloads, and the camera goes back to where it was.
third_person(unit, distance, yaw, pitch, show_unit, orbit) -> Pov
def third_person(
unit: Unit | int,
distance: float = 6.0,
yaw: float | None = None,
pitch: float = 25.0,
show_unit: bool = True,
orbit: bool = True,
) -> Pov| Argument | Type | Default | Description |
|---|---|---|---|
unit |
Unit | int |
required | The unit, as a Unit or its id. |
distance |
float |
6.0 |
How far the camera is from the unit's head, in world units. |
yaw |
float | None |
None |
The direction the camera faces, in degrees (Unity's convention: 0 looks along +z). None: behind the unit. |
pitch |
float |
25.0 |
How far the camera looks down, in degrees. |
show_unit |
bool |
True |
Whether the unit's model stays visible. |
orbit |
bool |
True |
Whether the player can turn the camera around the unit (middle mouse button) and move it closer or further (wheel). |
Follow unit from behind and above; returns a Pov.
The camera looks at the unit's head (or the top of its model). With orbit, read the view's
yaw, pitch and distance to keep where the player left it. The view is held and ends as
pov describes.
The game camera as get gives it.
A plain dict with these keys.
| Type | Key | Description |
|---|---|---|
float |
x |
Map x position. |
float |
y |
Height. |
float |
z |
Map z position. |
float |
yaw |
The direction it faces, in degrees (Unity's convention: 0 looks along +z). |
float |
pitch |
Degrees it looks down. |
float |
fov |
Its vertical field of view, in degrees. |
x: floatMap x position.
y: floatHeight.
z: floatMap z position.
yaw: floatThe direction it faces, in degrees (Unity's convention: 0 looks along +z).
pitch: floatDegrees it looks down.
fov: floatIts vertical field of view, in degrees.
A unit view from pov or third_person. Setting a property takes effect at the next frame.
| Type | Property | Description |
|---|---|---|
str |
mode read-only
|
"first" or "third". |
tuple[float, float, float] |
offset read-only
|
First person: (right, up, forward) from the anchor, in the unit's frame. |
tuple[float, float] | None |
look read-only
|
First person: (horizontal, vertical) look ranges in degrees, or None when off. |
float |
pitch read-only
|
Degrees the camera looks down (negative: up). |
float |
distance read-only
|
Third person: how far the camera is from the unit. |
float | None |
yaw read-only
|
Third person: the direction the camera faces, or None until it is first placed. |
bool |
show_unit read-only
|
Whether the unit's model stays visible. |
bool |
alive read-only
|
False once the view has ended. |
int |
unit read-only
|
The id of the unit the camera rides now (the wave fighter, during a wave). |
str |
type read-only
|
The unit type of the unit the view was started on. |
str |
anchor read-only
|
"head" or "top": where the view is measured from. |
| Returns | Method | Description |
|---|---|---|
None |
end() |
End the view and put the camera back; does nothing once it has ended. |
mode: str # read-only"first" or "third".
offset: tuple[float, float, float] # read-onlyFirst person: (right, up, forward) from the anchor, in the unit's frame.
look: tuple[float, float] | None # read-onlyFirst person: (horizontal, vertical) look ranges in degrees, or None when off.
pitch: float # read-onlyDegrees the camera looks down (negative: up).
distance: float # read-onlyThird person: how far the camera is from the unit.
yaw: float | None # read-onlyThird person: the direction the camera faces, or None until it is first placed.
show_unit: bool # read-onlyWhether the unit's model stays visible.
alive: bool # read-onlyFalse once the view has ended.
unit: int # read-onlyThe id of the unit the camera rides now (the wave fighter, during a wave).
type: str # read-onlyThe unit type of the unit the view was started on.
anchor: str # read-only"head" or "top": where the view is measured from.
def end() -> NoneEnd the view and put the camera back; does nothing once it has ended.
Using ProLeak
Features
Tutorial
- Your first plugin
- Plugin basics
- Handling events
- Plugin settings
- User interface
- Players, units and game data
- Purchases, signals and pings
- Chat, camera, input and more
- Game assets
- Game modes
- Game updates
- Publishing plugins
Reference