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...
PhysicsShapeQueryParameters2D
继承: RefCounted < Object
为 PhysicsDirectSpaceState2D 的方法提供参数。
描述
可以通过修改这个对象的形状等属性来为 PhysicsDirectSpaceState2D 的方法配置参数。
属性
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
属性说明
bool collide_with_areas = false 🔗
如果为 true,查询将考虑 Area2D。
bool collide_with_bodies = true 🔗
如果为 true,查询将考虑 PhysicsBody2D。
int collision_mask = 4294967295 🔗
查询将检测的物理层(作为位掩码)。默认情况下,会检测所有碰撞层。有关详细信息,请参阅文档中的 《碰撞层和掩码》。
将被排除在碰撞之外的对象的 RID 列表。请使用 CollisionObject2D.get_rid() 来获取与派生自 CollisionObject2D 的节点关联的 RID。
注意:返回的数组为副本,对其进行的修改不会更新原有属性。更新时,请先修改返回的数组,然后将其重新赋值回该属性。
形状的碰撞边距。
Vector2 motion = Vector2(0, 0) 🔗
正在查询的形状的运动。
将用于碰撞/相交查询的 Shape2D。存储的是实际的引用,可以避免该形状在进行查询时被释放,因此请优先使用这个属性,而不是 shape_rid。
将用于碰撞/相交查询的形状的 RID。如果你想要使用服务器 API 优化性能,请使用这个属性而不是 shape:
var shape_rid = PhysicsServer2D.circle_shape_create()
var radius = 64
PhysicsServer2D.shape_set_data(shape_rid, radius)
var params = PhysicsShapeQueryParameters2D.new()
params.shape_rid = shape_rid
# 在此处执行物理查询...
# 完成物理查询后释放形状。
PhysicsServer2D.free_rid(shape_rid)
RID shapeRid = PhysicsServer2D.CircleShapeCreate();
int radius = 64;
PhysicsServer2D.ShapeSetData(shapeRid, radius);
var params = new PhysicsShapeQueryParameters2D();
params.ShapeRid = shapeRid;
// 在此处执行物理查询...
// 完成物理查询后释放形状。
PhysicsServer2D.FreeRid(shapeRid);
Transform2D transform = Transform2D(1, 0, 0, 1, 0, 0) 🔗
void set_transform(value: Transform2D)
Transform2D get_transform()
被查询形状的变换矩阵。