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...
KinematicCollision3D¶
继承: RefCounted < Object
存放移动 PhysicsBody3D 所产生的碰撞数据。
描述¶
存放移动 PhysicsBody3D 所产生的碰撞数据,通常是由 PhysicsBody3D.move_and_collide 产生的。移动 PhysicsBody3D 时,它会在检测到与另一个实体发生碰撞时停止。检测到碰撞时就会返回 KinematicCollision3D 对象。
碰撞数据包括碰撞对象、剩余运动和碰撞位置。可以使用该数据进行碰撞的自定义响应。
方法¶
get_angle(collision_index: int = 0, up_direction: Vector3 = Vector3(0, 1, 0)) const |
|
get_collider(collision_index: int = 0) const |
|
get_collider_id(collision_index: int = 0) const |
|
get_collider_rid(collision_index: int = 0) const |
|
get_collider_shape(collision_index: int = 0) const |
|
get_collider_shape_index(collision_index: int = 0) const |
|
get_collider_velocity(collision_index: int = 0) const |
|
get_collision_count() const |
|
get_depth() const |
|
get_local_shape(collision_index: int = 0) const |
|
get_normal(collision_index: int = 0) const |
|
get_position(collision_index: int = 0) const |
|
get_remainder() const |
|
get_travel() const |
方法说明¶
float get_angle(collision_index: int = 0, up_direction: Vector3 = Vector3(0, 1, 0)) const 🔗
根据 up_direction
返回碰撞角度,默认为 Vector3.UP。该值始终为正。
Object get_collider(collision_index: int = 0) const 🔗
给定碰撞索引(默认情况下最深的碰撞),返回该碰撞实体所附加的 Object。
int get_collider_id(collision_index: int = 0) const 🔗
给定碰撞索引(默认情况下最深的碰撞),返回该碰撞实体所附加的 Object 的唯一实例 ID。请参阅 Object.get_instance_id。
RID get_collider_rid(collision_index: int = 0) const 🔗
给定碰撞索引(默认情况下最深的碰撞),返回被 PhysicsServer3D 使用的碰撞实体的 RID。
Object get_collider_shape(collision_index: int = 0) const 🔗
给定碰撞索引(默认情况下最深的碰撞),返回该碰撞实体的形状。
int get_collider_shape_index(collision_index: int = 0) const 🔗
给定碰撞索引(默认情况下最深的碰撞),返回该碰撞实体的形状索引。请参阅 CollisionObject3D。
Vector3 get_collider_velocity(collision_index: int = 0) const 🔗
给定碰撞索引(默认情况下最深的碰撞),返回该碰撞实体的速度。
int get_collision_count() const 🔗
返回检测到的碰撞次数。
返回该碰撞物体沿碰撞法线覆盖的长度。
Object get_local_shape(collision_index: int = 0) const 🔗
给定碰撞索引(默认情况下最深的碰撞),返回移动的对象的碰撞形状。
Vector3 get_normal(collision_index: int = 0) const 🔗
给定碰撞索引(默认情况下最深的碰撞),返回在碰撞点处该碰撞实体的形状的法线。
Vector3 get_position(collision_index: int = 0) const 🔗
给定碰撞索引(默认情况下最深的碰撞),返回以全局坐标表示的碰撞点。
Vector3 get_remainder() const 🔗
返回移动对象的剩余移动向量。
返回移动对象的在碰撞前的运动。