Struct gdnative_bindings_lily::physics_body_2d::PhysicsBody2D [−][src]
pub struct PhysicsBody2D { /* fields omitted */ }
Expand description
core class PhysicsBody2D
inherits CollisionObject2D
(unsafe).
Official documentation
See the documentation of this class in the Godot engine’s official documentation. The method descriptions are generated from it and typically contain code samples in GDScript, not Rust.
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
Adds a body to the list of bodies that this body can’t collide with.
Returns an array of nodes that were added as collision exceptions for this body.
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.
Returns an individual bit on the [member collision_layer].
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.
Returns an individual bit on the [member collision_mask].
Removes a body from the list of bodies that this body can’t collide with.
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.
Sets individual bits on the [member collision_layer] bitmask. Use this if you only need to change one layer’s value.
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.
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>
Creates a new shape owner for the given object. Returns owner_id
of the new owner for future reference.
Returns the one_way_collision_margin
of the shape owner identified by given owner_id
.
Returns an [Array] of owner_id
identifiers. You can use these ids in other methods that take owner_id
as an argument.
If true
, 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 collision_layer
bit to be set.
If true
, the shape owner and its shapes are disabled.
Returns true
if collisions for the shape owner originating from this CollisionObject2D will not be reported to collided with CollisionObject2Ds.
Removes the given shape owner.
If true
, 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 collision_layer
bit to be set.
Returns the owner_id
of the given shape.
Adds a Shape2D to the shape owner.
Removes all shapes from the shape owner.
Returns the parent object of the given shape owner.
Returns the Shape2D with the given id from the given shape owner.
Returns the number of shapes the given shape owner contains.
Returns the child index of the Shape2D with the given id from the given shape owner.
Returns the shape owner’s Transform2D.
Removes a shape from the given shape owner.
If true
, disables the given shape owner.
If enable
is true
, collisions for the shape owner originating from this CollisionObject2D will not be reported to collided with CollisionObject2Ds.
Sets the one_way_collision_margin
of the shape owner identified by given owner_id
to margin
pixels.
Sets the Transform2D of the given shape owner.
Trait Implementations
type Target = CollisionObject2D
type Target = CollisionObject2D
The resulting type after dereferencing.
Dereferences the value.
Mutably dereferences the value.
type RefKind = ManuallyManaged
type RefKind = ManuallyManaged
Creates an explicitly null reference of Self
as a method argument. This makes type
inference easier for the compiler compared to Option
. Read more
Creates a new instance of Self
using a zero-argument constructor, as a Unique
reference. Read more
Performs a dynamic reference downcast to target type. Read more
Performs a static reference upcast to a supertype that is guaranteed to be valid. Read more
Creates a persistent reference to the same Godot object with shared thread access. Read more
unsafe fn assume_thread_local(&self) -> Ref<Self, ThreadLocal> where
Self: GodotObject<RefKind = RefCounted>,
unsafe fn assume_thread_local(&self) -> Ref<Self, ThreadLocal> where
Self: GodotObject<RefKind = RefCounted>,
Creates a persistent reference to the same Godot object with thread-local thread access. Read more
Creates a persistent reference to the same Godot object with unique access. Read more
Recovers a instance ID previously returned by Object::get_instance_id
if the object is
still alive. See also TRef::try_from_instance_id
. Read more
Auto Trait Implementations
impl RefUnwindSafe for PhysicsBody2D
impl !Send for PhysicsBody2D
impl !Sync for PhysicsBody2D
impl Unpin for PhysicsBody2D
impl UnwindSafe for PhysicsBody2D