Skip to content

Camera3D Resource

A resource type that overrides the various properties of the Camera3D that the PCam3D will control once becoming active.

Once a resource has been applied to a Camera3D it will retain those property values until overriden by another Pcam3D and its resource.

Properties

cull_mask

Type: int

Default: 1048575

Overrides the cull_mask property of the Camera3D once becoming active.

A simplified helper setter method can be found in the example code below.


Setter

void set_cull_mask(int cull_mask_layer)

void set_cull_mask_value(int layer_number, bool value)

Example
gdscript
# Use this to assign a specific layer value.
# Fairly complex to use, so the function below this is recommended.
pcam.set_cull_mask(1048575)

# Use this helper method to enable or disable a specific layer.
pcam.set_cull_mask_value(2, false)

Getter

int get_cull_mask()

Example
gdscript
pcam.get_cull_mask()

h_offset

Type: float

Default: 0

Overrides the h_offset property of the Camera3D once becoming active.


Setter

void set_h_offset(float offset)

Example
gdscript
pcam.set_h_offset(4.2)

Getter

float get_h_offset()

Example
gdscript
pcam.get_h_offset()

v_offset

Type: float

Default: 0

Overrides the v_offset property of the Camera3D once becoming active.


Setter

void v_offset(float offset)

Example
gdscript
pcam.set_v_offset(4.2)

Getter

float get_v_offset()

Example
gdscript
pcam.get_camera_v_offset()

projection

Type: int

Default: 0

Overrides the projection property of the Camera3D once becoming active.

Projection Type NameValue
PERSPECTIVE0
ORTHOGONAL1
FRUSTUM2

Setter

void set_projection(int projection_type)

Example
gdscript
pcam.set_projection(1)

# Instead of applying an int directly,
# it's also possible to supply an enum value like so:
pcam.set_projection(Camera3DResource.ProjectionType.ORTHOGONAL)

Getter

int get_projection()

Example
gdscript
pcam.get_projection()

fov

Type: float

Default: 75

Overrides the fov (Field of View) property of the Camera3D once becoming active.

Note

This property is only available when projection is set to Perspective.


Setter

void set_fov(float fov)

Example
gdscript
pcam.set_fov(4.2)

Getter

float get_fov()

Example
gdscript
pcam.get_fov()

size

Type: float

Default: 75

Overrides the size property of the Camera3D once becoming active.

Note

This property is only available when projection is set to either Orthogonal or Frustum.


Setter

void set_size(float fov)

Example
gdscript
pcam.set_size(4.2)

Getter

float get_size()

Example
gdscript
pcam.get_size()

frustum_offset

Type: Vector2

Default: 75

Overrides the frustum_offset property of the Camera3D once becoming active.

Note

This property is only available when projection is set to Frustum.


Setter

void set_frustum_offset(Vector2 frustum_offset)

Example
gdscript
pcam.set_frustum_offset(Vector2(4.2, 4.2))

Getter

Vector2 get_frustum_offset()

Example
gdscript
pcam.get_frustum_offset()

near

Type: float

Default: 0.05

Overrides the near property of the Camera3D once becoming active.


Setter

void set_near(float near)

Example
gdscript
pcam.set_near(4.2)

Getter

float get_near()

Example
gdscript
pcam.get_near()

far

Type: float

Default: 4000

Overrides the far property of the Camera3D once becoming active.


Setter

void set_far(float far)

Example
gdscript
pcam.set_far(4200)

Getter

float get_far()

Example
gdscript
pcam.get_far()