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.
Checking the stable version of the documentation...
CollisionShape2D
繼承: Node2D < CanvasItem < Node < Object
向 CollisionObject2D 父級提供 Shape2D 的節點。
說明
A node that provides a Shape2D to a CollisionObject2D parent and allows it to be edited. This can give a detection shape to an Area2D or turn a PhysicsBody2D into a solid object.
教學
屬性
|
||
|
||
|
||
|
||
|
||
屬性說明
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 🔗
Sets whether this collision shape should only detect collision on one side (top or bottom).
Note: This property has no effect if this CollisionShape2D is a child of an Area2D node.
Note: The one way collision direction can be configured by setting one_way_collision_direction.
Vector2 one_way_collision_direction = Vector2(0, 1) 🔗
The direction used for one-way collision.
float one_way_collision_margin = 1.0 🔗
用於單向碰撞的邊距(以圖元為單位)。較高的值將使形狀更厚,並且對於高速進入形狀的對撞機來說效果更好。
該碰撞形狀擁有的實際形狀。