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...
PhysicsRayQueryParameters3D
繼承: RefCounted < Object
為 PhysicsDirectSpaceState3D.intersect_ray() 提供參數。
說明
By changing various properties of this object, such as the ray position, you can configure the parameters for PhysicsDirectSpaceState3D.intersect_ray().
Note: For optimal performance results, it is recommended to create this object in advance, store it, and reuse it for every subsequent query.
屬性
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
方法
create(from: Vector3, to: Vector3, collision_mask: int = 4294967295, exclude: Array[RID] = []) static |
屬性說明
bool collide_with_areas = false 🔗
如果為 true,則查詢將考慮 Area3D。
bool collide_with_bodies = true 🔗
如果為 true,則查詢將考慮 PhysicsBody3D。
int collision_mask = 4294967295 🔗
查詢將偵測的實體層(作為位元遮罩)。預設情況下,會偵測所有碰撞層。有關詳細資訊,請參閱文件中的 《碰撞層和遮罩》。
將被排除在碰撞之外的物件的 RID 清單。請使用 CollisionObject3D.get_rid() 來取得與派生自 CollisionObject3D 的節點關聯的 RID。
注意:回傳的陣列為副本,對其進行的修改不會更新原有屬性。更新時,請先修改回傳的陣列,然後將其重新賦值回該屬性。
Vector3 from = Vector3(0, 0, 0) 🔗
要查詢的射線起點,使用全域座標。
如果為 true,查詢將命中背部面,這些背部面是啟用了背面的凹多邊形形狀,或高度圖形狀。
bool hit_from_inside = false 🔗
如果為 true,查詢會在從形狀內部開始時偵測到命中。在此情況下,碰撞法線將為 Vector3(0, 0, 0)。不會影響凹多邊形形狀和高度圖形狀。
Vector3 to = Vector3(0, 0, 0) 🔗
要查詢的射線終點,使用全域座標。
方法說明
PhysicsRayQueryParameters3D create(from: Vector3, to: Vector3, collision_mask: int = 4294967295, exclude: Array[RID] = []) static 🔗
返回一個新的、預配置的 PhysicsRayQueryParameters3D 對象。使用它可以使用最常見的選項快速建立查詢參數。
var query = PhysicsRayQueryParameters3D.create(position, position + Vector3(0, -10, 0))
var collision = get_world_3d().direct_space_state.intersect_ray(query)