Difference between revisions of "R3d.Body:testPointInside"

From GiderosMobile
m (Text replacement - "</source>" to "</syntaxhighlight>")
Line 5: Line 5:
  
 
=== Description ===
 
=== Description ===
Checks if a point is inside any collision shapes of the body.
+
Checks if a 3D point is inside a RigidBody.
 
<syntaxhighlight lang="lua">
 
<syntaxhighlight lang="lua">
 
(bool) = r3d.Body:testPointInside(x,y,z)
 
(bool) = r3d.Body:testPointInside(x,y,z)
 
</syntaxhighlight>
 
</syntaxhighlight>
 +
 +
'''World Query Collider'''
 +
 +
A world query collider is a collider used to perform world queries on it. World queries are manual queries perform on the physics world like raycasting or testing if two collider collide or overlap.
  
 
=== Parameters ===
 
=== Parameters ===
Line 16: Line 20:
  
 
=== Return values ===
 
=== Return values ===
'''Returns''' (boolean) true if a point is inside any collision shapes of the body.<br/>
+
'''Returns''' (boolean) true if a point is inside a RigidBody<br/>
  
 
=== Example ===
 
=== Example ===
 
<syntaxhighlight lang="lua">
 
<syntaxhighlight lang="lua">
bool = ship.body:testPointInside(0, 4, 0))
+
local tpi = player1.body:testPointInside(0, 1, 0)
 +
if tpi then
 +
print(tpi)
 +
end
 
</syntaxhighlight>
 
</syntaxhighlight>
  
 
{{R3d.Body}}
 
{{R3d.Body}}

Revision as of 23:16, 18 December 2025


Available since: Gideros 2019.10
Class: R3d.Body

Description

Checks if a 3D point is inside a RigidBody.

(bool) = r3d.Body:testPointInside(x,y,z)

World Query Collider

A world query collider is a collider used to perform world queries on it. World queries are manual queries perform on the physics world like raycasting or testing if two collider collide or overlap.

Parameters

x: (number) the position of the point in the X axis world coordinate
y: (number) the position of the point in the Y axis world coordinate
z: (number) the position of the point in the Z axis world coordinate

Return values

Returns (boolean) true if a point is inside a RigidBody

Example

local tpi = player1.body:testPointInside(0, 1, 0)
if tpi then
	print(tpi)
end