Attention: Here be dragons

This is the latest (unstable) version of this documentation, which may document features not available in or compatible with released stable versions of Godot.

StaticBody2D

Inherits: PhysicsBody2D < CollisionObject2D < Node2D < CanvasItem < Node < Object

Inherited By: AnimatableBody2D

无法被外力移动的 2D 物理物体。手动移动时不会影响路径上的其他物体。

Description

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, AnimationPlayers (with AnimationPlayer.playback_process_mode set to AnimationPlayer.ANIMATION_PROCESS_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 constant_linear_velocity and constant_angular_velocity).

Properties

float

constant_angular_velocity

0.0

Vector2

constant_linear_velocity

Vector2(0, 0)

PhysicsMaterial

physics_material_override


Property Descriptions

float constant_angular_velocity = 0.0

  • void set_constant_angular_velocity ( float value )

  • float get_constant_angular_velocity ( )

该物体的恒定角速度。不会旋转该物体,但会影响接触的物体,就好像这个物体正在旋转一样。


Vector2 constant_linear_velocity = Vector2(0, 0)

  • void set_constant_linear_velocity ( Vector2 value )

  • Vector2 get_constant_linear_velocity ( )

该物体的恒定线速度。不会移动该物体,但会影响接触的物体,就好像这个物体正在移动一样。


PhysicsMaterial physics_material_override

物体的物理材质。

如果为该属性指定了一种材质,则将使用该材质代替任何其他物理材质,例如继承的材质。