CollisionShape2D
繼承: Node2D < CanvasItem < Node < Object
向 CollisionObject2D 父級提供 Shape2D 的節點。
說明
向 CollisionObject2D 父級提供 Shape2D 並允許對其進行編輯的節點。這可以為 Area2D 提供偵測形狀或將 PhysicsBody2D 轉變為實體物件。
教學
屬性
|
||
|
||
|
||
|
||
屬性說明
Color debug_color = Color(0, 0, 0, 0) 🔗
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.
禁用的碰撞形狀在世界中沒有影響。這個屬性應該用 Object.set_deferred() 改變。
bool one_way_collision = false 🔗
設定此碰撞形狀是否僅應偵測到一側(頂部或底部)的碰撞。
注意:如果這個 CollisionShape2D 是 Area2D 節點的子節點,則這個屬性無效。
float one_way_collision_margin = 1.0 🔗
用於單向碰撞的邊距(以圖元為單位)。較高的值將使形狀更厚,並且對於高速進入形狀的對撞機來說效果更好。
該碰撞形狀擁有的實際形狀。