[][src]Struct gdnative::api::ClippedCamera

pub struct ClippedCamera { /* fields omitted */ }

core class ClippedCamera inherits Camera (unsafe).

Official documentation

See the documentation of this class in the Godot engine's official documentation.

Memory management

Non reference counted objects such as the ones of this type are usually owned by the engine.

ClippedCamera is a reference-only type. Persistent references can only exist in the unsafe Ref<ClippedCamera> form.

In the cases where Rust code owns an object of this type, for example if the object was just created on the Rust side and not passed to the engine yet, ownership should be either given to the engine or the object must be manually destroyed using Ref::free, or Ref::queue_free if it is a Node.

Class hierarchy

ClippedCamera inherits methods from:

Safety

All types in the Godot API have "interior mutability" in Rust parlance. To enforce that the official thread-safety guidelines are followed, the typestate pattern is used in the Ref and TRef smart pointers, and the Instance API. The typestate Access in these types tracks whether the access is unique, shared, or exclusive to the current thread. For more information, see the type-level documentation on Ref.

Implementations

impl ClippedCamera[src]

Constants

impl ClippedCamera[src]

pub fn new() -> Ref<ClippedCamera, Unique>[src]

Creates a new instance of this object.

Because this type is not reference counted, the lifetime of the returned object is not automatically managed.

Immediately after creation, the object is owned by the caller, and can be passed to the engine (in which case the engine will be responsible for destroying the object) or destroyed manually using Ref::free, or preferably Ref::queue_free if it is a Node.

pub fn add_exception(&self, node: impl AsArg<Object>)[src]

Adds a collision exception so the camera does not collide with the specified node.

pub fn add_exception_rid(&self, rid: Rid)[src]

Adds a collision exception so the camera does not collide with the specified [RID].

pub fn clear_exceptions(&self)[src]

Removes all collision exceptions.

pub fn get_clip_offset(&self) -> f64[src]

Returns the distance the camera has been offset due to a collision.

pub fn collision_mask(&self) -> i64[src]

The camera's collision mask. Only objects in at least one collision layer matching the mask will be detected. See [url=https://docs.godotengine.org/en/latest/tutorials/physics/physics_introduction.html#collision-layers-and-masks]Collision layers and masks[/url] in the documentation for more information.

pub fn get_collision_mask_bit(&self, bit: i64) -> bool[src]

Returns [code]true[/code] if the specified bit index is on.
				[b]Note:[/b] Bit indices range from 0-19.

pub fn margin(&self) -> f64[src]

The camera's collision margin. The camera can't get closer than this distance to a colliding object.

pub fn process_mode(&self) -> ProcessMode[src]

The camera's process callback. See [enum ProcessMode].

pub fn is_clip_to_areas_enabled(&self) -> bool[src]

If [code]true[/code], the camera stops on contact with [Area]s.

pub fn is_clip_to_bodies_enabled(&self) -> bool[src]

If [code]true[/code], the camera stops on contact with [PhysicsBody]s.

pub fn remove_exception(&self, node: impl AsArg<Object>)[src]

Removes a collision exception with the specified node.

pub fn remove_exception_rid(&self, rid: Rid)[src]

Removes a collision exception with the specified [RID].

pub fn set_clip_to_areas(&self, enable: bool)[src]

If [code]true[/code], the camera stops on contact with [Area]s.

pub fn set_clip_to_bodies(&self, enable: bool)[src]

If [code]true[/code], the camera stops on contact with [PhysicsBody]s.

pub fn set_collision_mask(&self, mask: i64)[src]

The camera's collision mask. Only objects in at least one collision layer matching the mask will be detected. See [url=https://docs.godotengine.org/en/latest/tutorials/physics/physics_introduction.html#collision-layers-and-masks]Collision layers and masks[/url] in the documentation for more information.

pub fn set_collision_mask_bit(&self, bit: i64, value: bool)[src]

Sets the specified bit index to the [code]value[/code].
				[b]Note:[/b] Bit indices range from 0-19.

pub fn set_margin(&self, margin: f64)[src]

The camera's collision margin. The camera can't get closer than this distance to a colliding object.

pub fn set_process_mode(&self, process_mode: i64)[src]

The camera's process callback. See [enum ProcessMode].

Methods from Deref<Target = Camera>

pub fn clear_current(&self, enable_next: bool)[src]

If this is the current camera, remove it from being current. If [code]enable_next[/code] is [code]true[/code], request to make the next camera current, if any.

Default Arguments

  • enable_next - true

pub fn get_camera_rid(&self) -> Rid[src]

Returns the camera's RID from the [VisualServer].

pub fn get_camera_transform(&self) -> Transform[src]

Gets the camera transform. Subclassed cameras such as [InterpolatedCamera] may provide different transforms than the [Node] transform.

pub fn cull_mask(&self) -> i64[src]

The culling mask that describes which 3D render layers are rendered by this camera.

pub fn get_cull_mask_bit(&self, layer: i64) -> bool[src]

Returns [code]true[/code] if the given [code]layer[/code] in the [member cull_mask] is enabled, [code]false[/code] otherwise.

pub fn doppler_tracking(&self) -> DopplerTracking[src]

If not [constant DOPPLER_TRACKING_DISABLED], this camera will simulate the [url=https://en.wikipedia.org/wiki/Doppler_effect]Doppler effect[/url] for objects changed in particular [code]_process[/code] methods. See [enum DopplerTracking] for possible values.

pub fn environment(&self) -> Option<Ref<Environment, Shared>>[src]

The [Environment] to use for this camera.

pub fn fov(&self) -> f64[src]

The camera's field of view angle (in degrees). Only applicable in perspective mode. Since [member keep_aspect] locks one axis, [code]fov[/code] sets the other axis' field of view angle.

pub fn get_frustum(&self) -> VariantArray<Shared>[src]

Returns the camera's frustum planes in world-space units as an array of [Plane]s in the following order: near, far, left, top, right, bottom. Not to be confused with [member frustum_offset].

pub fn frustum_offset(&self) -> Vector2D<f32, UnknownUnit>[src]

The camera's frustum offset. This can be changed from the default to create "tilted frustum" effects such as [url=https://zdoom.org/wiki/Y-shearing]Y-shearing[/url].

pub fn h_offset(&self) -> f64[src]

The horizontal (X) offset of the camera viewport.

pub fn keep_aspect_mode(&self) -> KeepAspect[src]

The axis to lock during [member fov]/[member size] adjustments. Can be either [constant KEEP_WIDTH] or [constant KEEP_HEIGHT].

pub fn projection(&self) -> Projection[src]

The camera's projection mode. In [constant PROJECTION_PERSPECTIVE] mode, objects' Z distance from the camera's local space scales their perceived size.

pub fn size(&self) -> f64[src]

The camera's size measured as 1/2 the width or height. Only applicable in orthogonal mode. Since [member keep_aspect] locks on axis, [code]size[/code] sets the other axis' size length.

pub fn v_offset(&self) -> f64[src]

The vertical (Y) offset of the camera viewport.

pub fn zfar(&self) -> f64[src]

The distance to the far culling boundary for this camera relative to its local Z axis.

pub fn znear(&self) -> f64[src]

The distance to the near culling boundary for this camera relative to its local Z axis.

pub fn is_current(&self) -> bool[src]

If [code]true[/code], the ancestor [Viewport] is currently using this camera.

pub fn is_position_behind(
    &self,
    world_point: Vector3D<f32, UnknownUnit>
) -> bool
[src]

Returns [code]true[/code] if the given position is behind the camera.
				[b]Note:[/b] A position which returns [code]false[/code] may still be outside the camera's field of view.

pub fn make_current(&self)[src]

Makes this camera the current camera for the [Viewport] (see class description). If the camera node is outside the scene tree, it will attempt to become current once it's added.

pub fn project_local_ray_normal(
    &self,
    screen_point: Vector2D<f32, UnknownUnit>
) -> Vector3D<f32, UnknownUnit>
[src]

Returns a normal vector from the screen point location directed along the camera. Orthogonal cameras are normalized. Perspective cameras account for perspective, screen width/height, etc.

pub fn project_position(
    &self,
    screen_point: Vector2D<f32, UnknownUnit>,
    z_depth: f64
) -> Vector3D<f32, UnknownUnit>
[src]

Returns the 3D point in worldspace that maps to the given 2D coordinate in the [Viewport] rectangle on a plane that is the given [code]z_depth[/code] distance into the scene away from the camera.

pub fn project_ray_normal(
    &self,
    screen_point: Vector2D<f32, UnknownUnit>
) -> Vector3D<f32, UnknownUnit>
[src]

Returns a normal vector in worldspace, that is the result of projecting a point on the [Viewport] rectangle by the camera projection. This is useful for casting rays in the form of (origin, normal) for object intersection or picking.

pub fn project_ray_origin(
    &self,
    screen_point: Vector2D<f32, UnknownUnit>
) -> Vector3D<f32, UnknownUnit>
[src]

Returns a 3D position in worldspace, that is the result of projecting a point on the [Viewport] rectangle by the camera projection. This is useful for casting rays in the form of (origin, normal) for object intersection or picking.

pub fn set_cull_mask(&self, mask: i64)[src]

The culling mask that describes which 3D render layers are rendered by this camera.

pub fn set_cull_mask_bit(&self, layer: i64, enable: bool)[src]

Enables or disables the given [code]layer[/code] in the [member cull_mask].

pub fn set_current(&self, arg0: bool)[src]

If [code]true[/code], the ancestor [Viewport] is currently using this camera.

pub fn set_doppler_tracking(&self, mode: i64)[src]

If not [constant DOPPLER_TRACKING_DISABLED], this camera will simulate the [url=https://en.wikipedia.org/wiki/Doppler_effect]Doppler effect[/url] for objects changed in particular [code]_process[/code] methods. See [enum DopplerTracking] for possible values.

pub fn set_environment(&self, env: impl AsArg<Environment>)[src]

The [Environment] to use for this camera.

pub fn set_fov(&self, arg0: f64)[src]

The camera's field of view angle (in degrees). Only applicable in perspective mode. Since [member keep_aspect] locks one axis, [code]fov[/code] sets the other axis' field of view angle.

pub fn set_frustum(
    &self,
    size: f64,
    offset: Vector2D<f32, UnknownUnit>,
    z_near: f64,
    z_far: f64
)
[src]

Sets the camera projection to frustum mode (see [constant PROJECTION_FRUSTUM]), by specifying a [code]size[/code], an [code]offset[/code], and the [code]z_near[/code] and [code]z_far[/code] clip planes in world-space units.

pub fn set_frustum_offset(&self, arg0: Vector2D<f32, UnknownUnit>)[src]

The camera's frustum offset. This can be changed from the default to create "tilted frustum" effects such as [url=https://zdoom.org/wiki/Y-shearing]Y-shearing[/url].

pub fn set_h_offset(&self, ofs: f64)[src]

The horizontal (X) offset of the camera viewport.

pub fn set_keep_aspect_mode(&self, mode: i64)[src]

The axis to lock during [member fov]/[member size] adjustments. Can be either [constant KEEP_WIDTH] or [constant KEEP_HEIGHT].

pub fn set_orthogonal(&self, size: f64, z_near: f64, z_far: f64)[src]

Sets the camera projection to orthogonal mode (see [constant PROJECTION_ORTHOGONAL]), by specifying a [code]size[/code], and the [code]z_near[/code] and [code]z_far[/code] clip planes in world-space units. (As a hint, 2D games often use this projection, with values specified in pixels.)

pub fn set_perspective(&self, fov: f64, z_near: f64, z_far: f64)[src]

Sets the camera projection to perspective mode (see [constant PROJECTION_PERSPECTIVE]), by specifying a [code]fov[/code] (field of view) angle in degrees, and the [code]z_near[/code] and [code]z_far[/code] clip planes in world-space units.

pub fn set_projection(&self, arg0: i64)[src]

The camera's projection mode. In [constant PROJECTION_PERSPECTIVE] mode, objects' Z distance from the camera's local space scales their perceived size.

pub fn set_size(&self, arg0: f64)[src]

The camera's size measured as 1/2 the width or height. Only applicable in orthogonal mode. Since [member keep_aspect] locks on axis, [code]size[/code] sets the other axis' size length.

pub fn set_v_offset(&self, ofs: f64)[src]

The vertical (Y) offset of the camera viewport.

pub fn set_zfar(&self, arg0: f64)[src]

The distance to the far culling boundary for this camera relative to its local Z axis.

pub fn set_znear(&self, arg0: f64)[src]

The distance to the near culling boundary for this camera relative to its local Z axis.

pub fn unproject_position(
    &self,
    world_point: Vector3D<f32, UnknownUnit>
) -> Vector2D<f32, UnknownUnit>
[src]

Returns the 2D coordinate in the [Viewport] rectangle that maps to the given 3D point in worldspace.

Trait Implementations

impl Debug for ClippedCamera[src]

impl Deref for ClippedCamera[src]

type Target = Camera

The resulting type after dereferencing.

impl DerefMut for ClippedCamera[src]

impl GodotObject for ClippedCamera[src]

type RefKind = ManuallyManaged

The memory management kind of this type. This modifies the behavior of the Ref smart pointer. See its type-level documentation for more information. Read more

impl Instanciable for ClippedCamera[src]

impl QueueFree for ClippedCamera[src]

impl SubClass<Camera> for ClippedCamera[src]

impl SubClass<Node> for ClippedCamera[src]

impl SubClass<Object> for ClippedCamera[src]

impl SubClass<Spatial> for ClippedCamera[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> SubClass<T> for T where
    T: GodotObject
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.