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.

PhysicsTestMotionResult2D

繼承: RefCounted < Object

描述 PhysicsServer2D.body_test_motion() 的運動和碰撞結果。

說明

描述 PhysicsServer2D.body_test_motion() 的運動和碰撞結果。

方法

Object

get_collider() const

int

get_collider_id() const

RID

get_collider_rid() const

int

get_collider_shape() const

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

float

get_collision_unsafe_fraction() const

Vector2

get_remainder() const

Vector2

get_travel() const


方法說明

Object get_collider() const 🔗

如果發生了碰撞,則返回相撞物體所附加的 Object


int get_collider_id() const 🔗

如果發生了碰撞,則返回相撞物體所附加 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 🔗

返回可以運動但不發生碰撞的最大比例,在 01 之間。


float get_collision_unsafe_fraction() const 🔗

如果發生了碰撞,則返回碰撞運動所需的最小摩擦力,在 01 之間。


Vector2 get_remainder() const 🔗

返回移動對象的剩餘移動向量。


Vector2 get_travel() const 🔗

返回移動物件的在碰撞前的運動。