CollisionPolygon3D

繼承: Node3D < Node < Object

CollisionObject3D 父級提供加厚多邊形形狀(角柱體)的節點。

說明

CollisionObject3D 父級提供加厚多邊形形狀(角柱體)的節點,能夠為這個形狀提供編輯的方法。該多邊形可以是凹多邊形,也可以是凸多邊形。能夠為 Area3D 提供偵測形狀,也能夠將 PhysicsBody3D 變為實體。

警告:非均勻縮放的 CollisionShape3D 應該無法按預期工作。請確保它在所有軸上的縮放是一致的,可以用對形狀資源的調整來代替非均勻縮放。

屬性

Color

debug_color

Color(0, 0, 0, 0)

bool

debug_fill

true

float

depth

1.0

bool

disabled

false

float

margin

0.04

PackedVector2Array

polygon

PackedVector2Array()


屬性說明

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

  • void set_debug_color(value: Color)

  • Color get_debug_color()

The collision shape color that is displayed in the editor, or in the running project if Debug > Visible Collision Shapes is checked at the top of the editor.

Note: The default value is ProjectSettings.debug/shapes/collision/shape_color. The Color(0, 0, 0, 0) value documented here is a placeholder, and not the actual default debug color.


bool debug_fill = true 🔗

  • void set_enable_debug_fill(value: bool)

  • bool get_enable_debug_fill()

If true, when the shape is displayed, it will show a solid fill color in addition to its wireframe.


float depth = 1.0 🔗

產生的碰撞沿著與 2D 多邊形垂直的任意方向深入的長度。


bool disabled = false 🔗

  • void set_disabled(value: bool)

  • bool is_disabled()

If true, no collision will be produced. This property should be changed with Object.set_deferred().


float margin = 0.04 🔗

  • void set_margin(value: float)

  • float get_margin()

生成的 Shape3D 的碰撞邊距。詳情見 Shape3D.margin


PackedVector2Array polygon = PackedVector2Array() 🔗

Array of vertices which define the 2D polygon in the local XY plane.

Note: The returned array is copied and any changes to it will not update the original property value. See PackedVector2Array for more details.