StaticBody2D
A 2D physics body that can't be moved by external forces. When moved manually, it doesn't affect other bodies in its path.
A 2D physics body that can't be moved by external forces. When moved manually, it doesn't affect other bodies in its path.
A static 2D physics body. It can't be moved by external forces or contacts, but can be moved manually by other means such as code, AnimationMixers (with AnimationMixer.CallbackModeProcess set to AnimationMixer.AnimationCallbackModeProcess.Physics), and RemoteTransform2D.
When StaticBody2D is moved, it is teleported to its new position without affecting other physics bodies in its path. If this is not desired, use AnimatableBody2D instead.
StaticBody2D is useful for completely static objects like floors and walls, as well as moving surfaces like conveyor belts and circular revolving platforms (by using StaticBody2D.ConstantLinearVelocity and StaticBody2D.ConstantAngularVelocity).
Declarations checked against C# SDK 1.0.0. Expand a name to see declarations and documentation.
Constructors1
StaticBody2DConstructor
public StaticBody2D();Properties3
ConstantAngularVelocityProperty
public float ConstantAngularVelocity { get; set; }The body's constant angular velocity. This does not rotate the body, but affects touching bodies, as if it were rotating.
ConstantLinearVelocityProperty
public Vector2 ConstantLinearVelocity { get; set; }The body's constant linear velocity. This does not move the body, but affects touching bodies, as if it were moving.
PhysicsMaterialOverrideProperty
public PhysicsMaterial PhysicsMaterialOverride { get; set; }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.
Methods6
GetConstantAngularVelocityfloat
public float GetConstantAngularVelocity();floatGetConstantLinearVelocityVector2
public Vector2 GetConstantLinearVelocity();Vector2GetPhysicsMaterialOverridePhysicsMaterial
public PhysicsMaterial GetPhysicsMaterialOverride();PhysicsMaterialSetConstantAngularVelocityvoid
public void SetConstantAngularVelocity(float vel);| Name | Type | Default |
|---|---|---|
vel | float | — |
SetConstantLinearVelocityvoid
public void SetConstantLinearVelocity(Vector2 vel);| Name | Type | Default |
|---|---|---|
vel | Vector2 | — |
SetPhysicsMaterialOverridevoid
public void SetPhysicsMaterialOverride(PhysicsMaterial physicsMaterialOverride);| Name | Type | Default |
|---|---|---|
physicsMaterialOverride | PhysicsMaterial | — |