Skip to content

class Projector3d (client-side)

Available since version: 0.3.4

This class represents 3d projector, that can be used to display 2d elements in 3d worlds via simple projection.

Constructor

Projector3d(float x, float y, float z, float distance)

Parameters:

  • float x: the position in the world on the x axis.
  • float y: the position in the world on the y axis.
  • float z: the position in the world on the z axis.
  • float distance: the maximum visible distance in the world.

Properties

Vec3& position

Represents the 3d position on the world for projector 3d.


float distance

Represents the visible distance for projector 3d.


bool visible (read-only)

Represents the visible state for projector 3d.


int fps

Represents the fps ratio that will be used to determine how often onUpdate callback should be called (default -1). Set to -1 if you don't want to limit onUpdate refresh rate.


Methods

No methods.


Callbacks

onVisibilityChange

This callback is being executed when projector visibility gets changed.

void onVisibilityChange(bool visible)

Parameters:

  • bool visible: the current visibility state.

onUpdate

This callback is being executed each frame when 3d projection is visible, use it to implement your custom update logic.

void onUpdate(Vec2i screenPositionPx, float deltaDistance)

Parameters:

  • Vec2i screenPositionPx: the calculated screen position in pixels.
  • float deltaDistance: the current 3d distance between 3d projected position and player.