Up to date

This page is up to date for Godot 4.2. If you still find outdated information, please open an issue.

Joint2D

继承: Node2D < CanvasItem < Node < Object

派生: DampedSpringJoint2D, GrooveJoint2D, PinJoint2D

所有 2D 物理关节的抽象基类。

描述

2D 物理中所有关节的抽象基类。2D 关节能够将两个物理体绑定在一起并施加约束。

属性

float

bias

0.0

bool

disable_collision

true

NodePath

node_a

NodePath("")

NodePath

node_b

NodePath("")

方法

RID

get_rid ( ) const


属性说明

float bias = 0.0

  • void set_bias ( float value )

  • float get_bias ( )

node_anode_b 向不同方向移动时,bias 控制关节将它们拉回到原始位置的速度。bias 越低,两个实体对该关节的拉力就越大。

当被设置为 0 时,使用来自 ProjectSettings.physics/2d/solver/default_constraint_bias 的默认值。


bool disable_collision = true

  • void set_exclude_nodes_from_collision ( bool value )

  • bool get_exclude_nodes_from_collision ( )

如果为 true,则 node_anode_b 无法碰撞。


NodePath node_a = NodePath("")

连接到关节的第一个实体。必须继承自 PhysicsBody2D


NodePath node_b = NodePath("")

连接到关节的第二个实体。必须继承自 PhysicsBody2D


方法说明

RID get_rid ( ) const

返回关节的 RID