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...
KinematicCollision2D
繼承: RefCounted < Object
存放移動 PhysicsBody2D 所產生的碰撞資料。
說明
存放移動 PhysicsBody2D 所產生的碰撞資料,通常是由 PhysicsBody2D.move_and_collide() 產生的。移動 PhysicsBody2D 時,它會在偵測到與另一個實體發生碰撞時停止。偵測到碰撞時就會返回 KinematicCollision2D 對象。
碰撞封包括碰撞物件、剩餘運動和碰撞位置。可以使用該資料進行碰撞的自訂響應。
方法
get_collider() const |
|
get_collider_id() const |
|
get_collider_rid() const |
|
get_collider_shape() const |
|
get_collider_shape_index() const |
|
get_collider_velocity() const |
|
get_depth() const |
|
get_local_shape() const |
|
get_normal() const |
|
get_position() const |
|
get_remainder() const |
|
get_travel() const |
方法說明
float get_angle(up_direction: Vector2 = Vector2(0, -1)) const 🔗
根據 up_direction 返回碰撞角度,up_direction 預設為 Vector2.UP。該返回值始終為正。
返回該碰撞實體所附加的 Object。
返回該碰撞物體附加的 Object 的唯一實例 ID。見 Object.get_instance_id()。
RID get_collider_rid() const 🔗
返回 PhysicsServer2D 使用的碰撞物體的 RID。
Object get_collider_shape() const 🔗
返回該碰撞物體的形狀。
int get_collider_shape_index() const 🔗
返回該碰撞物體形狀的索引。見 CollisionObject2D。
Vector2 get_collider_velocity() const 🔗
返回該碰撞物體的速度。
返回該碰撞物體沿碰撞法線覆蓋的長度。
Object get_local_shape() const 🔗
返回移動對象的碰撞形狀。
返回該碰撞物體的形狀在碰撞點的法線。
Vector2 get_position() const 🔗
返回碰撞點,使用全域座標。
Vector2 get_remainder() const 🔗
返回移動對象的剩餘移動向量。
返回移動物件的在碰撞前的運動。