PhysicsRayQueryParameters3D

继承: RefCounted < Object

PhysicsDirectSpaceState3D.intersect_ray()提供参数。

描述

通过更改此对象的各种属性,例如射线位置,您可以配置PhysicsDirectSpaceState3D.intersect_ray()的参数。

属性

方法

PhysicsRayQueryParameters3D

create(from: Vector3, to: Vector3, collision_mask: int = 4294967295, exclude: Array[RID] = []) static


属性说明

bool collide_with_areas = false 🔗

  • void set_collide_with_areas(value: bool)

  • bool is_collide_with_areas_enabled()

如果true,则查询将考虑AreaTrigger


bool collide_with_bodies = true 🔗

  • void set_collide_with_bodies(value: bool)

  • bool is_collide_with_bodies_enabled()

如果true,则查询将考虑PhysicsBulkBase


int collision_mask = 4294967295 🔗

  • void set_collision_mask(value: int)

  • int get_collision_mask()

查询将检测到的物理层(作为位掩码)。默认情况下,会检测到所有冲突层。有关详细信息,请参阅文档中的冲突层和掩码


Array[RID] exclude = [] 🔗

将被排除在冲突之外的对象RID的列表。使用ColliderObjectBase.get_rid()获取与ColliderObjectBase派生节点关联的RID

注意:返回的数组被复制,对其的任何更改都不会更新原始属性值。要更新值,您需要修改返回的数组,然后再次将其分配给属性。


Vector3 from = Vector3(0, 0, 0) 🔗

正在查询的射线的起点,在全局坐标中。


bool hit_back_faces = true 🔗

  • void set_hit_back_faces(value: bool)

  • bool is_hit_back_faces_enabled()

如果true,则查询将回击具有启用背面的凹多边形形状或高度图形状的背面。


bool hit_from_inside = false 🔗

  • void set_hit_from_inside(value: bool)

  • bool is_hit_from_inside_enabled()

如果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)