PhysicsShapeQueryParameters3D

继承: RefCounted < Object

PhysicsDirectSpaceState3D.intersect_shape()提供参数。

描述

通过更改此对象的各种属性,例如形状,您可以配置PhysicsDirectSpaceState3D.intersect_shape()的参数。

属性

bool

collide_with_areas

false

bool

collide_with_bodies

true

int

collision_mask

4294967295

Array[RID]

exclude

[]

float

margin

0.0

Vector3

motion

Vector3(0, 0, 0)

Resource

shape

RID

shape_rid

RID()

Transform3D

transform

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


属性说明

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

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


float margin = 0.0 🔗

  • void set_margin(value: float)

  • float get_margin()

形状的碰撞余量。


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

被查询的形状的运动。


Resource shape 🔗

将用于碰撞/交集查询的Shape3D。这存储了实际引用,避免了在用于查询时释放形状,因此总是更喜欢使用它而不是shape_rid


RID shape_rid = RID() 🔗

  • void set_shape_rid(value: RID)

  • RID get_shape_rid()

将用于碰撞/相交查询的被查询形状的 RID。如果您想使用服务器 API 进行性能优化,请使用此选项而非 shape

var shape_rid = PhysicsServer3D.shape_create(PhysicsServer3D.SHAPE_SPHERE)
var radius = 2.0
PhysicsServer3D.shape_set_data(shape_rid, radius)

var params = PhysicsShapeQueryParameters3D.new()
params.shape_rid = shape_rid

# 在此执行物理查询操作......

# 完成物理查询后释放形状。
PhysicsServer3D.free_rid(shape_rid)

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

查询到的形状的变换矩阵。