[][src]Struct gdnative::api::PhysicsBody2D

pub struct PhysicsBody2D { /* fields omitted */ }

core class PhysicsBody2D inherits CollisionObject2D (unsafe).

Official documentation

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

Class hierarchy

PhysicsBody2D 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 PhysicsBody2D[src]

pub fn add_collision_exception_with(&self, body: impl AsArg<Node>)[src]

Adds a body to the list of bodies that this body can't collide with.

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

Returns an array of nodes that were added as collision exceptions for this body.

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

The physics layers this area is in.
			Collidable objects can exist in any of 32 different layers. These layers work like a tagging system, and are not visual. A collidable can use these layers to select with which objects it can collide, using the [member collision_mask] property.
			A contact is detected if object A is in any of the layers that object B scans, or object B is in any layer scanned by object A. 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_layer_bit(&self, bit: i64) -> bool[src]

Returns an individual bit on the [member collision_layer].

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

The physics layers this area scans for collisions. 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 an individual bit on the [member collision_mask].

pub fn remove_collision_exception_with(&self, body: impl AsArg<Node>)[src]

Removes a body from the list of bodies that this body can't collide with.

pub fn set_collision_layer(&self, layer: i64)[src]

The physics layers this area is in.
			Collidable objects can exist in any of 32 different layers. These layers work like a tagging system, and are not visual. A collidable can use these layers to select with which objects it can collide, using the [member collision_mask] property.
			A contact is detected if object A is in any of the layers that object B scans, or object B is in any layer scanned by object A. 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_layer_bit(&self, bit: i64, value: bool)[src]

Sets individual bits on the [member collision_layer] bitmask. Use this if you only need to change one layer's value.

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

The physics layers this area scans for collisions. 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 individual bits on the [member collision_mask] bitmask. Use this if you only need to change one layer's value.

Methods from Deref<Target = CollisionObject2D>

pub fn create_shape_owner(&self, owner: impl AsArg<Object>) -> i64[src]

Creates a new shape owner for the given object. Returns [code]owner_id[/code] of the new owner for future reference.

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

Returns the object's [RID].

pub fn get_shape_owner_one_way_collision_margin(&self, owner_id: i64) -> f64[src]

Returns the [code]one_way_collision_margin[/code] of the shape owner identified by given [code]owner_id[/code].

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

Returns an [Array] of [code]owner_id[/code] identifiers. You can use these ids in other methods that take [code]owner_id[/code] as an argument.

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

If [code]true[/code], this object is pickable. A pickable object can detect the mouse pointer entering/leaving, and if the mouse is inside it, report input events. Requires at least one [code]collision_layer[/code] bit to be set.

pub fn is_shape_owner_disabled(&self, owner_id: i64) -> bool[src]

If [code]true[/code], the shape owner and its shapes are disabled.

pub fn is_shape_owner_one_way_collision_enabled(&self, owner_id: i64) -> bool[src]

Returns [code]true[/code] if collisions for the shape owner originating from this [CollisionObject2D] will not be reported to collided with [CollisionObject2D]s.

pub fn remove_shape_owner(&self, owner_id: i64)[src]

Removes the given shape owner.

pub fn set_pickable(&self, enabled: bool)[src]

If [code]true[/code], this object is pickable. A pickable object can detect the mouse pointer entering/leaving, and if the mouse is inside it, report input events. Requires at least one [code]collision_layer[/code] bit to be set.

pub fn shape_find_owner(&self, shape_index: i64) -> i64[src]

Returns the [code]owner_id[/code] of the given shape.

pub fn shape_owner_add_shape(&self, owner_id: i64, shape: impl AsArg<Shape2D>)[src]

Adds a [Shape2D] to the shape owner.

pub fn shape_owner_clear_shapes(&self, owner_id: i64)[src]

Removes all shapes from the shape owner.

pub fn shape_owner_get_owner(
    &self,
    owner_id: i64
) -> Option<Ref<Object, Shared>>
[src]

Returns the parent object of the given shape owner.

pub fn shape_owner_get_shape(
    &self,
    owner_id: i64,
    shape_id: i64
) -> Option<Ref<Shape2D, Shared>>
[src]

Returns the [Shape2D] with the given id from the given shape owner.

pub fn shape_owner_get_shape_count(&self, owner_id: i64) -> i64[src]

Returns the number of shapes the given shape owner contains.

pub fn shape_owner_get_shape_index(&self, owner_id: i64, shape_id: i64) -> i64[src]

Returns the child index of the [Shape2D] with the given id from the given shape owner.

pub fn shape_owner_get_transform(
    &self,
    owner_id: i64
) -> Transform2D<f32, UnknownUnit, UnknownUnit>
[src]

Returns the shape owner's [Transform2D].

pub fn shape_owner_remove_shape(&self, owner_id: i64, shape_id: i64)[src]

Removes a shape from the given shape owner.

pub fn shape_owner_set_disabled(&self, owner_id: i64, disabled: bool)[src]

If [code]true[/code], disables the given shape owner.

pub fn shape_owner_set_one_way_collision(&self, owner_id: i64, enable: bool)[src]

If [code]enable[/code] is [code]true[/code], collisions for the shape owner originating from this [CollisionObject2D] will not be reported to collided with [CollisionObject2D]s.

pub fn shape_owner_set_one_way_collision_margin(
    &self,
    owner_id: i64,
    margin: f64
)
[src]

Sets the [code]one_way_collision_margin[/code] of the shape owner identified by given [code]owner_id[/code] to [code]margin[/code] pixels.

pub fn shape_owner_set_transform(
    &self,
    owner_id: i64,
    transform: Transform2D<f32, UnknownUnit, UnknownUnit>
)
[src]

Sets the [Transform2D] of the given shape owner.

Trait Implementations

impl Debug for PhysicsBody2D[src]

impl Deref for PhysicsBody2D[src]

type Target = CollisionObject2D

The resulting type after dereferencing.

impl DerefMut for PhysicsBody2D[src]

impl GodotObject for PhysicsBody2D[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 QueueFree for PhysicsBody2D[src]

impl SubClass<CanvasItem> for PhysicsBody2D[src]

impl SubClass<CollisionObject2D> for PhysicsBody2D[src]

impl SubClass<Node> for PhysicsBody2D[src]

impl SubClass<Node2D> for PhysicsBody2D[src]

impl SubClass<Object> for PhysicsBody2D[src]

impl SubClass<PhysicsBody2D> for KinematicBody2D[src]

impl SubClass<PhysicsBody2D> for RigidBody2D[src]

impl SubClass<PhysicsBody2D> for StaticBody2D[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.