PhysicsShapeQueryParameters3D

继承: RefCounted < Object

PhysicsDirectSpaceState3D.intersect_shape 提供参数。

描述

你可以通过修改这个对象的形状等属性来为 PhysicsDirectSpaceState3D.intersect_shape 配置参数。

属性

bool

collide_with_areas

false

bool

collide_with_bodies

true

int

collision_mask

4294967295

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 ( bool value )

  • bool is_collide_with_areas_enabled ( )

如果为 true,则查询将考虑 Area3D


bool collide_with_bodies = true

  • void set_collide_with_bodies ( bool value )

  • bool is_collide_with_bodies_enabled ( )

如果为 true,则查询将考虑 PhysicsBody3D


int collision_mask = 4294967295

  • void set_collision_mask ( int value )

  • int get_collision_mask ( )

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


RID[] exclude = []

  • void set_exclude ( RID[] value )

  • RID[] get_exclude ( )

将被排除在碰撞之外的对象的 RID 列表。请使用 CollisionObject3D.get_rid 来获取与派生自 CollisionObject3D 的节点关联的 RID


float margin = 0.0

  • void set_margin ( float value )

  • float get_margin ( )

形状的碰撞边距。


Vector3 motion = Vector3(0, 0, 0)

正在查询的形状的运动。


Resource shape

将用于碰撞/相交查询的 Shape3D。存储的是实际的引用,可以避免该形状在进行查询时被释放,因此请优先使用这个属性,而不是 shape_rid


RID shape_rid = RID()

  • void set_shape_rid ( RID value )

  • RID get_shape_rid ( )

The queried shape’s RID that will be used for collision/intersection queries. Use this over shape if you want to optimize for performance using the Servers API:

GDScriptC#

  1. var shape_rid = PhysicsServer3D.shape_create(PhysicsServer3D.SHAPE_SPHERE)
  2. var radius = 2.0
  3. PhysicsServer3D.shape_set_data(shape_rid, radius)
  4. var params = PhysicsShapeQueryParameters3D.new()
  5. params.shape_rid = shape_rid
  6. # Execute physics queries here...
  7. # Release the shape when done with physics queries.
  8. PhysicsServer3D.free_rid(shape_rid)
  1. RID shapeRid = PhysicsServer3D.ShapeCreate(PhysicsServer3D.ShapeType.Sphere);
  2. float radius = 2.0f;
  3. PhysicsServer3D.ShapeSetData(shapeRid, radius);
  4. var params = new PhysicsShapeQueryParameters3D();
  5. params.ShapeRid = shapeRid;
  6. // Execute physics queries here...
  7. // Release the shape when done with physics queries.
  8. PhysicsServer3D.FreeRid(shapeRid);

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

被查询形状的变换矩阵。

Previous Next


© 版权所有 2014-present Juan Linietsky, Ariel Manzur and the Godot community (CC BY 3.0). Revision b1c660f7.

Built with Sphinx using a theme provided by Read the Docs.