WorldBoundaryShape2D
继承: Shape2D
< Resource
< RefCounted
< Object
A 2D world boundary (half-plane) shape used for physics collision.
描述
A 2D world boundary shape, intended for use in physics. WorldBoundaryShape2D works like an infinite straight line that forces all physics bodies to stay above it. The line's normal determines which direction is considered as "above" and in the editor, the smaller line over it represents this direction. It can for example be used for endless flat floors.
属性
属性说明
float
distance = 0.0
The distance from the origin to the line, expressed in terms of normal
(according to its direction and magnitude). Actual absolute distance from the origin to the line can be calculated as abs(distance) / normal.length()
.
In the scalar equation of the line ax + by = d
, this is d
, while the (a, b)
coordinates are represented by the normal
property.
Vector2
normal = Vector2(0, -1)
The line's normal, typically a unit vector. Its direction indicates the non-colliding half-plane. Can be of any length but zero. Defaults to Vector2.UP
.
本方法通常需要用户覆盖才能生效。
本方法无副作用,不会修改该实例的任何成员变量。
本方法除了能接受在此处描述的参数外,还能够继续接受任意数量的参数。
本方法用于构造某个类型。
调用本方法无需实例,可直接使用类名进行调用。
本方法描述的是使用本类型作为左操作数的有效运算符。
这个值是由下列位标志构成位掩码的整数。
无返回值。