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.

PhysicsMaterial

繼承: Resource < RefCounted < Object

存放與表面的物理相關的屬性,也就是粗糙度和反彈度。

說明

存放與表面的物理相關的屬性,也就是粗糙度和反彈度。這個類用於將這些屬性套用至物理體。

屬性

bool

absorbent

false

float

bounce

0.0

float

friction

1.0

bool

rough

false


屬性說明

bool absorbent = false 🔗

  • void set_absorbent(value: bool)

  • bool is_absorbent()

如果為 true,則從碰撞對象的彈跳性中減去彈性,而不是新增它。


float bounce = 0.0 🔗

  • void set_bounce(value: float)

  • float get_bounce()

The body's bounciness. Values range from 0 (no bounce) to 1 (full bounciness).

Note: Even with bounce set to 1.0, some energy will be lost over time due to linear and angular damping. To have a physics body that preserves all its energy over time, set bounce to 1.0, the body's linear damp mode to Replace (if applicable), its linear damp to 0.0, its angular damp mode to Replace (if applicable), and its angular damp to 0.0.


float friction = 1.0 🔗

  • void set_friction(value: float)

  • float get_friction()

物體的摩擦。取值範圍從 0(無摩擦)到 1(最大摩擦)。


bool rough = false 🔗

  • void set_rough(value: bool)

  • bool is_rough()

如果為 true,當兩個物體碰撞時,物理引擎將使用標記為“粗糙”的物體的摩擦。如果 false,物理引擎將使用所有碰撞物體的最低摩擦力來代替。如果兩個碰撞的物件都為 true,物理引擎將使用最高的摩擦力。