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 形狀的抽象基底類別,針對物理使用設計。

性能:對圖元形狀進行碰撞偵測很快,尤其是 SphereShape3DConvexPolygonShape3DHeightMapShape3D 較慢,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()

The shape's custom solver bias. Defines how much bodies react to enforce contact separation when this shape is involved.

When set to 0, the default value from ProjectSettings.physics/3d/solver/default_contact_bias is used.

Note: custom_solver_bias is only effective when using GodotPhysics3D. It has no effect when using Jolt Physics.


float margin = 0.04 🔗

  • void set_margin(value: float)

  • float get_margin()

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

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


方法說明

ArrayMesh get_debug_mesh() 🔗

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