http://www.oxeyegames.com/wiki/index.php?title=GetEntitySensorPoints&feed=atom&action=historyGetEntitySensorPoints - Revision history2024-03-28T18:31:33ZRevision history for this page on the wikiMediaWiki 1.16.0http://www.oxeyegames.com/wiki/index.php?title=GetEntitySensorPoints&diff=413&oldid=prevJeb: Created page with '{{PhysicsMethod| physics:getEntitySensorPoints(entityId) | Fetches a list of current sensor intersection points for a given entity. This list will not include real collisions, th...'2010-02-07T12:59:37Z<p>Created page with '{{PhysicsMethod| physics:getEntitySensorPoints(entityId) | Fetches a list of current sensor intersection points for a given entity. This list will not include real collisions, th...'</p>
<p><b>New page</b></p><div>{{PhysicsMethod|<br />
physics:getEntitySensorPoints(entityId)<br />
|<br />
Fetches a list of current sensor intersection points for a given entity. This list will not include real collisions, they are stored in a separate list and are fetched with [[getEntityCollisions]].<br />
|<br />
{{MethodParam|enitityId|An integer|The entity's body identifier.}}<br />
|<br />
Returns a table containing collision elements (see below). If no intersections are found, this method returns nil to save some garbage collection performance. In other words, the returned table is never empty, it's either nil or non-empty.<br />
}}<br />
<br />
=== Collision Info ===<br />
<br />
The returned table contains a list of intersection points. Each point has the following info:<br />
<br />
{| border=2 cellpadding=3 cellspacing=0 style="margin: 0 0 1em 1em; border-collapse: collapse;"<br />
|-<br />
|style="background:#c797d7"| '''Parameter'''<br />
|style="background:#c797d7"| '''Type'''<br />
|style="background:#c797d7"| '''Description'''<br />
|-<br />
{{MethodParam|x|A number|The world X position of the collision point, measured in meters.}}<br />
{{MethodParam|y|A number|The world Y position of the collision point, measured in meters.}}<br />
{{MethodParam|nx|A number|The collision point normal's normalized X value. This value has no meaning for intersections.}}<br />
{{MethodParam|ny|A number|The collision point normal's normalized Y value. This value has no meaning for intersections.}}<br />
{{MethodParam|impulse|A number|The collision impulse. This value has no meaning for intersections.}}<br />
{{MethodParam|id|An integer|The entity identifier of the body that this entity has collided with.}}<br />
{{MethodParam|userData|A string|If the other entity has userData in the shape that this entity has collided with, that userData will be copied to this value. This is usually nil. See [[Common Shape Settings]].}}<br />
|}<br />
<br />
<br />
=== Example ===<br />
<pre><br />
<br />
local collisions = physics:getEntitySensorPoints(player.body)<br />
if collisions then<br />
for index, info in ipairs(collisions) do<br />
local userData = info.userData or "n/a"<br />
print("Intersection with ".. info.id .. " at (" .. info.x .. ", " .. info.y .. "), " .. userData)<br />
end<br />
end<br />
<br />
</pre></div>Jeb