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...
PhysicsTestMotionResult2D
繼承: RefCounted < Object
描述 PhysicsServer2D.body_test_motion() 的運動和碰撞結果。
說明
描述 PhysicsServer2D.body_test_motion() 的運動和碰撞結果。
方法
get_collider() const |
|
get_collider_id() const |
|
get_collider_rid() const |
|
get_collider_shape() const |
|
get_collider_velocity() const |
|
get_collision_depth() const |
|
get_collision_local_shape() const |
|
get_collision_normal() const |
|
get_collision_point() const |
|
get_collision_safe_fraction() const |
|
get_collision_unsafe_fraction() const |
|
get_remainder() const |
|
get_travel() const |
方法說明
如果發生了碰撞,則返回相撞物體所附加的 Object。
如果發生了碰撞,則返回相撞物體所附加 Object 的唯一實例 ID。見 Object.get_instance_id()。
RID get_collider_rid() const 🔗
如果發生了碰撞,則返回相撞物體在 PhysicsServer2D 中使用的 RID。
int get_collider_shape() const 🔗
如果發生了碰撞,則返回相撞物體形狀的索引。見 CollisionObject2D。
Vector2 get_collider_velocity() const 🔗
如果發生了碰撞,則返回相撞物體的速度。
float get_collision_depth() const 🔗
如果發生了碰撞,則返回沿碰撞法線的重疊長度。
int get_collision_local_shape() const 🔗
如果發生了碰撞,則返回移動物件的碰撞形狀。
Vector2 get_collision_normal() const 🔗
如果發生了碰撞,則返回碰撞物體形狀在碰撞點處的法線。
Vector2 get_collision_point() const 🔗
如果發生了碰撞,則返回使用全域座標表示的碰撞點。
float get_collision_safe_fraction() const 🔗
返回可以運動但不發生碰撞的最大比例,在 0 和 1 之間。
float get_collision_unsafe_fraction() const 🔗
如果發生了碰撞,則返回碰撞運動所需的最小摩擦力,在 0 和 1 之間。
Vector2 get_remainder() const 🔗
返回移動對象的剩餘移動向量。
返回移動物件的在碰撞前的運動。