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.

SeparationRayShape2D

繼承: Shape2D < Resource < RefCounted < Object

用於物理碰撞的 2D 射線形狀,會嘗試將自己與其他碰撞體分開。

說明

A 2D ray shape, intended for use in physics. Usually used to provide a shape for a CollisionShape2D. When a SeparationRayShape2D collides with an object, it tries to separate itself from it by moving its endpoint to the collision point. For example, a SeparationRayShape2D next to a character can allow it to instantly move up when touching stairs.

屬性

float

length

20.0

bool

slide_on_slope

false


屬性說明

float length = 20.0 🔗

  • void set_length(value: float)

  • float get_length()

射線的長度。


bool slide_on_slope = false 🔗

  • void set_slide_on_slope(value: bool)

  • bool get_slide_on_slope()

如果為 false(預設值),則形狀始終分離,並返回一條沿其自身方向的法線。

如果為 true,則該形狀可以返回正確的法線,並在任何方向上分離,允許在斜坡上滑動。