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.
Checking the stable version of the documentation...
SoftBody3D
繼承: MeshInstance3D < GeometryInstance3D < VisualInstance3D < Node3D < Node < Object
可形變的 3D 物理網格。
說明
A deformable 3D physics mesh. Used to create elastic or deformable objects such as cloth, rubber, or other flexible materials.
Additionally, SoftBody3D is subject to wind forces defined in Area3D (see Area3D.wind_source_path, Area3D.wind_force_magnitude, and Area3D.wind_attenuation_factor).
Note: It's recommended to use Jolt Physics when using SoftBody3D instead of the default GodotPhysics3D, as Jolt Physics' soft body implementation is faster and more reliable. You can switch the physics engine using the ProjectSettings.physics/3d/physics_engine project setting.
教學
屬性
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
方法
void |
add_collision_exception_with(body: Node) |
void |
apply_central_force(force: Vector3) |
void |
apply_central_impulse(impulse: Vector3) |
void |
apply_force(point_index: int, force: Vector3) |
void |
apply_impulse(point_index: int, impulse: Vector3) |
get_collision_layer_value(layer_number: int) const |
|
get_collision_mask_value(layer_number: int) const |
|
get_physics_rid() const |
|
get_point_transform(point_index: int) |
|
is_point_pinned(point_index: int) const |
|
void |
|
void |
set_collision_layer_value(layer_number: int, value: bool) |
void |
set_collision_mask_value(layer_number: int, value: bool) |
void |
set_point_pinned(point_index: int, pinned: bool, attachment_path: NodePath = NodePath(""), insert_at: int = -1) |
列舉
enum DisableMode: 🔗
DisableMode DISABLE_MODE_REMOVE = 0
當 Node.process_mode 被設定為 Node.PROCESS_MODE_DISABLED 時,從物理模擬中移除,停止與此 SoftBody3D 的所有物理互動。
當該 Node 再次被處理時,會自動重新加入到物理模擬中。
DisableMode DISABLE_MODE_KEEP_ACTIVE = 1
當 Node.process_mode 被設定為 Node.PROCESS_MODE_DISABLED 時,不影響物理模擬。
屬性說明
該 SoftBody3D 所在的實體層。碰撞物件可以存在於 32 個不同層中的一個或多個層中。另見 collision_mask。
注意:只有當物件 B 位於物件 A 掃描的任意層中時,物件 A 才能偵測到與對象 B 的接觸。有關更多資訊,請參閱文件中的《碰撞層與遮罩》。
該 SoftBody3D 掃描的實體層。碰撞物件可以掃描 32 個不同層中的一個或多個層。另見 collision_layer。
注意:只有當物件 B 位於物件 A 掃描的任何層中時,物件 A 才能偵測到與對象 B 的接觸。有關更多資訊,請參閱文件中的《碰撞層與遮罩》。
float damping_coefficient = 0.01 🔗
The body's damping coefficient. Higher values will slow down the body more noticeably when forces are applied.
DisableMode disable_mode = 0 🔗
void set_disable_mode(value: DisableMode)
DisableMode get_disable_mode()
Defines the behavior in physics when Node.process_mode is set to Node.PROCESS_MODE_DISABLED.
float drag_coefficient = 0.0 🔗
The body's drag coefficient. Higher values increase this body's air resistance.
Note: This value is currently unused by Godot's default physics implementation.
float linear_stiffness = 0.5 🔗
較高的值會導致身體更僵硬,而較低的值將增加身體的彎曲能力。該值可在0.0 和``1.0 ``(包含)。
NodePath parent_collision_ignore = NodePath("") 🔗
指向 CollisionObject3D 的 NodePath,這個 SoftBody3D 應該避免穿過它。
float pressure_coefficient = 0.0 🔗
The pressure coefficient of this soft body. Simulate pressure build-up from inside this body. Higher values increase the strength of this effect.
如果為 true,則該 SoftBody3D 會回應 RayCast3D。
float shrinking_factor = 0.0 🔗
Scales the rest lengths of SoftBody3D's edge constraints. Positive values shrink the mesh, while negative values expand it. For example, a value of 0.1 shortens the edges of the mesh by 10%, while -0.1 expands the edges by 10%.
Note: shrinking_factor is best used on surface meshes with pinned points.
int simulation_precision = 5 🔗
增加這個值會改善模擬結果,但會影響性能。請小心使用。
The SoftBody3D's mass.
方法說明
void add_collision_exception_with(body: Node) 🔗
將一個物體新增到這個物體不能碰撞的物體列表中。
void apply_central_force(force: Vector3) 🔗
Distributes and applies a force to all points. A force is time dependent and meant to be applied every physics update.
void apply_central_impulse(impulse: Vector3) 🔗
Distributes and applies an impulse to all points.
An impulse is time-independent! Applying an impulse every frame would result in a framerate-dependent force. For this reason, it should only be used when simulating one-time impacts (use the "_force" functions otherwise).
void apply_force(point_index: int, force: Vector3) 🔗
Applies a force to a point. A force is time dependent and meant to be applied every physics update.
void apply_impulse(point_index: int, impulse: Vector3) 🔗
Applies an impulse to a point.
An impulse is time-independent! Applying an impulse every frame would result in a framerate-dependent force. For this reason, it should only be used when simulating one-time impacts (use the "_force" functions otherwise).
Array[PhysicsBody3D] get_collision_exceptions() 🔗
返回該物體的碰撞例外節點陣列。
bool get_collision_layer_value(layer_number: int) const 🔗
返回 collision_layer 中是否啟用了指定的層,給定的 layer_number 應在 1 和 32 之間。
bool get_collision_mask_value(layer_number: int) const 🔗
返回 collision_mask 中是否啟用了指定的層,給定的 layer_number 應在 1 和 32 之間。
Returns the internal RID used by the PhysicsServer3D for this body.
Vector3 get_point_transform(point_index: int) 🔗
返回表面陣列中頂點的局部平移。
bool is_point_pinned(point_index: int) const 🔗
如果頂點設定為固定,則返回 true。
void remove_collision_exception_with(body: Node) 🔗
將一個物體從該物體不能碰撞的物體列表中移除。
void set_collision_layer_value(layer_number: int, value: bool) 🔗
根據 value,啟用或禁用 collision_layer 中指定的層,給定的 layer_number 應在 1 和 32 之間。
void set_collision_mask_value(layer_number: int, value: bool) 🔗
根據 value,啟用或禁用 collision_mask 中指定的層,給定的 layer_number 應在 1 和 32 之間。
void set_point_pinned(point_index: int, pinned: bool, attachment_path: NodePath = NodePath(""), insert_at: int = -1) 🔗
設定表面頂點的固定狀態。當設定為 true 時,可選的 attachment_path 可以定義一個 Node3D,該固定頂點將被附加到該節點。