Click or drag to resize

RigidBody2D Properties

The RigidBody2D type exposes the following members.

Properties
  NameDescription
Public property_ImportPath (Inherited from Node.)
Public propertyAngularDamp

Damps the body's AngularVelocity. If -1, the body will use the Default Angular Damp defined in Project > Project Settings > Physics > 2d.

See for more details about damping.

Public propertyAngularVelocity

The body's rotational velocity.

Public propertyAppliedForce

The body's total applied force.

Public propertyAppliedTorque

The body's total applied torque.

Public propertyBounce

The body's bounciness. Values range from 0 (no bounce) to 1 (full bounciness).

Deprecated, use Bounce instead via PhysicsMaterialOverride.

Public propertyCanSleep

If true, the body can enter sleep mode when there is no movement. See Sleeping.

Note: A RigidBody2D will never enter sleep mode automatically if its Mode is . It can still be put to sleep manually by setting its Sleeping property to true.

Public propertyCollisionLayer

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 CollisionMask 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 Collision layers and masks in the documentation for more information.

(Inherited from PhysicsBody2D.)
Public propertyCollisionMask

The physics layers this area scans for collisions. See Collision layers and masks in the documentation for more information.

(Inherited from PhysicsBody2D.)
Public propertyContactMonitor

If true, the body will emit signals when it collides with another RigidBody2D. See also ContactsReported.

Public propertyContactsReported

The maximum number of contacts that will be recorded. Requires ContactMonitor to be set to true.

Note: The number of contacts is different from the number of collisions. Collisions between parallel edges will result in two contacts (one at each end).

Public propertyContinuousCd

Continuous collision detection mode.

Continuous collision detection tries to predict where a moving body will collide instead of moving it and correcting its movement after collision. Continuous collision detection is slower, but more precise and misses fewer collisions with small, fast-moving objects. Raycasting and shapecasting methods are available. See RigidBody2DCCDMode for details.

Public propertyCustomIntegrator

If true, internal force integration is disabled for this body. Aside from collision response, the body will only move as determined by the _IntegrateForces(Physics2DDirectBodyState) function.

Public propertyCustomMultiplayer

The override to the default MultiplayerAPI. Set to null to use the default SceneTree one.

(Inherited from Node.)
Public propertyDynamicObject
Gets a new DynamicGodotObject associated with this instance.
(Inherited from Object.)
Public propertyEditorDescription (Inherited from Node.)
Public propertyFilename

When a scene is instanced from a file, its topmost node contains the filename from which it was loaded.

(Inherited from Node.)
Public propertyFriction

The body's friction. Values range from 0 (frictionless) to 1 (maximum friction).

Deprecated, use Friction instead via PhysicsMaterialOverride.

Public propertyGlobalPosition

Global position.

(Inherited from Node2D.)
Public propertyGlobalRotation

Global rotation in radians.

(Inherited from Node2D.)
Public propertyGlobalRotationDegrees

Global rotation in degrees.

(Inherited from Node2D.)
Public propertyGlobalScale

Global scale.

(Inherited from Node2D.)
Public propertyGlobalTransform

Global Transform2D.

(Inherited from Node2D.)
Public propertyGravityScale

Multiplies the gravity applied to the body. The body's gravity is calculated from the Default Gravity value in Project > Project Settings > Physics > 2d and/or any additional gravity vector applied by Area2Ds.

Public propertyInertia

The body's moment of inertia. This is like mass, but for rotation: it determines how much torque it takes to rotate the body. The moment of inertia is usually computed automatically from the mass and the shapes, but this function allows you to set a custom value. Set 0 inertia to return to automatically computing it.

Public propertyInputPickable

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.

(Inherited from CollisionObject2D.)
Public propertyLayers

Both CollisionLayer and CollisionMask. Returns CollisionLayer when accessed. Updates CollisionLayer and CollisionMask when modified.

(Inherited from PhysicsBody2D.)
Public propertyLightMask

The rendering layers in which this CanvasItem responds to Light2D nodes.

(Inherited from CanvasItem.)
Public propertyLinearDamp

Damps the body's LinearVelocity. If -1, the body will use the Default Linear Damp in Project > Project Settings > Physics > 2d.

See for more details about damping.

Public propertyLinearVelocity

The body's linear velocity.

Public propertyMass

The body's mass.

Public propertyMaterial

The material applied to textures on this CanvasItem.

(Inherited from CanvasItem.)
Public propertyMode
Public propertyModulate

The color applied to textures on this CanvasItem.

(Inherited from CanvasItem.)
Public propertyMultiplayer

The MultiplayerAPI instance associated with this node. Either the CustomMultiplayer, or the default SceneTree one (if inside tree).

(Inherited from Node.)
Public propertyName

The name of the node. This name is unique among the siblings (other child nodes from the same parent). When set to an existing name, the node will be automatically renamed.

Note: Auto-generated names might include the @ character, which is reserved for unique names when using AddChild(Node, Boolean). When setting the name manually, any @ will be removed.

(Inherited from Node.)
Public propertyNativeInstance (Inherited from Object.)
Public propertyOwner

The node owner. A node can have any other node as owner (as long as it is a valid parent, grandparent, etc. ascending in the tree). When saving a node (using PackedScene), all the nodes it owns will be saved with it. This allows for the creation of complex SceneTrees, with instancing and subinstancing.

(Inherited from Node.)
Public propertyPauseMode

Pause mode. How the node will behave if the SceneTree is paused.

(Inherited from Node.)
Public propertyPhysicsMaterialOverride

The physics material override for the body.

If a material is assigned to this property, it will be used instead of any other physics material, such as an inherited one.

Public propertyPosition

Position, relative to the node's parent.

(Inherited from Node2D.)
Public propertyProcessPriority

The node's priority in the execution order of the enabled processing callbacks (i.e. , and their internal counterparts). Nodes whose process priority value is lower will have their processing callbacks executed first.

(Inherited from Node.)
Public propertyRotation

Rotation in radians, relative to the node's parent.

(Inherited from Node2D.)
Public propertyRotationDegrees

Rotation in degrees, relative to the node's parent.

(Inherited from Node2D.)
Public propertyScale

The node's scale. Unscaled value: (1, 1).

(Inherited from Node2D.)
Public propertySelfModulate

The color applied to textures on this CanvasItem. This is not inherited by children CanvasItems.

(Inherited from CanvasItem.)
Public propertyShowBehindParent

If true, the object draws behind its parent.

(Inherited from CanvasItem.)
Public propertyShowOnTop

If true, the object draws on top of its parent.

(Inherited from CanvasItem.)
Public propertySleeping

If true, the body will not move and will not calculate forces until woken up by another body through, for example, a collision, or by using the ApplyImpulse(Vector2, Vector2) or AddForce(Vector2, Vector2) methods.

Public propertyTransform (Inherited from Node2D.)
Public propertyUseParentMaterial

If true, the parent CanvasItem's Material property is used as this one's material.

(Inherited from CanvasItem.)
Public propertyVisible

If true, this CanvasItem is drawn. The node is only visible if all of its antecedents are visible as well (in other words, IsVisibleInTree must return true).

Note: For controls that inherit Popup, the correct way to make them visible is to call one of the multiple popup*() functions instead.

(Inherited from CanvasItem.)
Public propertyWeight

The body's weight based on its mass and the Default Gravity value in Project > Project Settings > Physics > 2d.

Public propertyZAsRelative

If true, the node's Z index is relative to its parent's Z index. If this node's Z index is 2 and its parent's effective Z index is 3, then this node's effective Z index will be 2 + 3 = 5.

(Inherited from Node2D.)
Public propertyZIndex

Z index. Controls the order in which the nodes render. A node with a higher Z index will display in front of others.

(Inherited from Node2D.)
Top
See Also