From da3fbc0296139086f38ca811c0dba775d857e07b Mon Sep 17 00:00:00 2001 From: "Andrii Doroshenko (Xrayez)" Date: Mon, 27 Jan 2020 21:04:16 +0200 Subject: Expose shape property for shape query parameters classes Co-authored-by: PouleyKetchoupp --- doc/classes/PhysicsShapeQueryParameters2D.xml | 27 +++++++++++++++++---------- doc/classes/PhysicsShapeQueryParameters3D.xml | 27 +++++++++++++++++---------- 2 files changed, 34 insertions(+), 20 deletions(-) (limited to 'doc/classes') diff --git a/doc/classes/PhysicsShapeQueryParameters2D.xml b/doc/classes/PhysicsShapeQueryParameters2D.xml index 9a162dabbb..63e13954ab 100644 --- a/doc/classes/PhysicsShapeQueryParameters2D.xml +++ b/doc/classes/PhysicsShapeQueryParameters2D.xml @@ -9,15 +9,6 @@ - - - - - - - Sets the [Shape2D] that will be used for collision/intersection queries. - - @@ -38,8 +29,24 @@ The motion of the shape being queried for. + + The [Shape2D] that will be used for collision/intersection queries. This stores the actual reference which avoids the shape to be released while being used for queries, so always prefer using this over [member shape_rid]. + - The queried shape's [RID]. See also [method set_shape]. + The queried shape's [RID] that will be used for collision/intersection queries. Use this over [member shape] if you want to optimize for performance using the Servers API: + [codeblock] + 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 + + # Execute physics queries here... + + # Release the shape when done with physics queries. + PhysicsServer2D.free_rid(shape_rid) + [/codeblock] The queried shape's transform matrix. diff --git a/doc/classes/PhysicsShapeQueryParameters3D.xml b/doc/classes/PhysicsShapeQueryParameters3D.xml index 6606cfbc59..f4191d4862 100644 --- a/doc/classes/PhysicsShapeQueryParameters3D.xml +++ b/doc/classes/PhysicsShapeQueryParameters3D.xml @@ -9,15 +9,6 @@ - - - - - - - Sets the [Shape3D] that will be used for collision/intersection queries. - - @@ -35,8 +26,24 @@ The collision margin for the shape. + + The [Shape3D] that will be used for collision/intersection queries. This stores the actual reference which avoids the shape to be released while being used for queries, so always prefer using this over [member shape_rid]. + - The queried shape's [RID]. See also [method set_shape]. + The queried shape's [RID] that will be used for collision/intersection queries. Use this over [member shape] if you want to optimize for performance using the Servers API: + [codeblock] + 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 + + # Execute physics queries here... + + # Release the shape when done with physics queries. + PhysicsServer3D.free_rid(shape_rid) + [/codeblock] The queried shape's transform matrix. -- cgit v1.2.3