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.

PhysicsTestMotionParameters3D

繼承: RefCounted < Object

PhysicsServer3D.body_test_motion() 提供參數。

說明

更改該物件的運動等屬性可以配置 PhysicsServer3D.body_test_motion() 的參數。

屬性

bool

collide_separation_ray

false

Array[RID]

exclude_bodies

[]

Array[int]

exclude_objects

[]

Transform3D

from

Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0)

float

margin

0.001

int

max_collisions

1

Vector3

motion

Vector3(0, 0, 0)

bool

recovery_as_collision

false


屬性說明

bool collide_separation_ray = false 🔗

  • void set_collide_separation_ray_enabled(value: bool)

  • bool is_collide_separation_ray_enabled()

如果設定為 true,則 PhysicsServer3D.SHAPE_SEPARATION_RAY 型別的形狀用於偵測碰撞,並可以停止運動。吸附到地面時很有用。

如果設定為 false,則 PhysicsServer3D.SHAPE_SEPARATION_RAY 型別的形狀僅在與其他物體重疊時用於分離。這是分離射線形狀的主要用途。


Array[RID] exclude_bodies = [] 🔗

可選的物體 RID 陣列,會排除與這些物體的碰撞。請使用 CollisionObject3D.get_rid() 來獲取與衍生自 CollisionObject3D 的節點關聯的 RID


Array[int] exclude_objects = [] 🔗

可選的物件唯一實例 ID 陣列,會排除與這些實例的碰撞。見 Object.get_instance_id()


Transform3D from = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0) 🔗

運動開始處的全域空間變換。通常設為 Node3D.global_transform,使用目前物體的變換。


float margin = 0.001 🔗

  • void set_margin(value: float)

  • float get_margin()

增加碰撞偵測中涉及的形狀的大小。


int max_collisions = 1 🔗

  • void set_max_collisions(value: int)

  • int get_max_collisions()

返回碰撞的最大數量,在 132 之間。始終返回偵測到的最深碰撞。


Vector3 motion = Vector3(0, 0, 0) 🔗

運動向量,定義要測試的運動的長度和方向。


bool recovery_as_collision = false 🔗

  • void set_recovery_as_collision_enabled(value: bool)

  • bool is_recovery_as_collision_enabled()

如果設定為 true,則把恢復階段的穿透彙報為碰撞;使用場景包括 CharacterBody3D 提升地面吸附階段的地面偵測。

如果設定為 false,則只會彙報移動造成的碰撞,一般符合預期行為。