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.

CollisionShape3D

繼承: Node3D < Node < Object

向 CollisionObject3D 父級提供 Shape3D 的節點。

說明

向 CollisionObject3D 父級提供 Shape3D 並允許對其編輯的節點。可以為 Area3D 提供檢測形狀,或將 PhysicsBody3D 轉換為實體物件。

警告:非均勻縮放的 CollisionShape3D 可能無法按預期執行。請確保在所有軸上保持其縮放相同並改為調整其 shape 資源。

教學

屬性

Color

debug_color

Color(0, 0, 0, 0)

bool

debug_fill

true

bool

disabled

false

Shape3D

shape

方法

void

make_convex_from_siblings()

void

resource_changed(resource: Resource)


屬性說明

Color debug_color = Color(0, 0, 0, 0) 🔗

  • void set_debug_color(value: Color)

  • Color get_debug_color()

碰撞形狀的顏色,在編輯器中顯示,勾選編輯器頂部的 除錯 > 顯示碰撞形狀 時也會在執行專案時顯示。

注意:預設值為 ProjectSettings.debug/shapes/collision/shape_color。這裡記錄的 Color(0, 0, 0, 0) 值是佔位符,不是實際的預設除錯顏色。


bool debug_fill = true 🔗

  • void set_enable_debug_fill(value: bool)

  • bool get_enable_debug_fill()

如果為 true,則顯示形狀時除了顯示線框外還會顯示填充顏色。


bool disabled = false 🔗

  • void set_disabled(value: bool)

  • bool is_disabled()

停用的碰撞形狀在世界中沒有影響。這個屬性應該用 Object.set_deferred() 改變。


Shape3D shape 🔗

該碰撞形狀擁有的實際形狀。


方法說明

void make_convex_from_siblings() 🔗

將碰撞形狀的形狀設定為其所有凸面 MeshInstance3D 兄弟幾何體的相加。


void resource_changed(resource: Resource) 🔗

已棄用: Use Resource.changed instead.

這個方法甚麼也不做。