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.

Shape3D

繼承: Resource < RefCounted < Object

被繼承: BoxShape3D, CapsuleShape3D, ConcavePolygonShape3D, ConvexPolygonShape3D, CylinderShape3D, HeightMapShape3D, SeparationRayShape3D, SphereShape3D, WorldBoundaryShape3D

用於物理碰撞的 3D 形狀的抽象基底類別。

說明

所有 3D 形狀的抽象基底類別,針對物理使用設計。

效能:對圖元形狀進行碰撞偵測很快,尤其是 SphereShape3D。ConvexPolygonShape3D 和 HeightMapShape3D 較慢,ConcavePolygonShape3D 最慢。

教學

屬性

float

custom_solver_bias

0.0

float

margin

0.04

方法

ArrayMesh

get_debug_mesh()


屬性說明

float custom_solver_bias = 0.0 🔗

  • void set_custom_solver_bias(value: float)

  • float get_custom_solver_bias()

該形狀的自訂求解器偏差(Custom Solver Bias)。它定義了當該形狀參與碰撞時,剛體為了強制分離接觸點而產生的反應強度。

當設定為 0 時,將使用 ProjectSettings.physics/3d/solver/default_contact_bias 中定義的預設值。

注意: custom_solver_bias 僅在使用 GodotPhysics3D 物理引擎時生效。在使用 Jolt Physics 時,該參數沒有任何效果。


float margin = 0.04 🔗

  • void set_margin(value: float)

  • float get_margin()

該形狀的碰撞邊距。Godot Physics 中未使用。

碰撞邊距允許通過在形狀周圍新增額外的外殼來使碰撞偵測更有效。當物體重疊的部分超過其邊距時,碰撞演算法的成本會更高,所以邊距的數值越高對效能越好,但代價是邊緣的精度會降低,因為會讓邊緣的銳度降低。


方法說明

ArrayMesh get_debug_mesh() 🔗

返回用於繪製此 Shape3D 的除錯碰撞的 ArrayMesh。