<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.multitheftauto.com/wiki/PhysicsShapeCast?action=history&amp;feed=atom</id>
	<title>PhysicsShapeCast - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.multitheftauto.com/wiki/PhysicsShapeCast?action=history&amp;feed=atom"/>
	<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=PhysicsShapeCast&amp;action=history"/>
	<updated>2026-04-04T20:37:28Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.39.3</generator>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=PhysicsShapeCast&amp;diff=65143&amp;oldid=prev</id>
		<title>CrosRoad95: /* Returns */</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=PhysicsShapeCast&amp;diff=65143&amp;oldid=prev"/>
		<updated>2020-02-13T20:29:28Z</updated>

		<summary type="html">&lt;p&gt;&lt;span dir=&quot;auto&quot;&gt;&lt;span class=&quot;autocomment&quot;&gt;Returns&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 20:29, 13 February 2020&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l23&quot;&gt;Line 23:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 23:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;*'''hitpoint''' {x,y,z} - contact point.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;*'''hitpoint''' {x,y,z} - contact point.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;*'''hitnormal''' {x,y,z} - contact normal vector.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;*'''hitnormal''' {x,y,z} - contact normal vector.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;*'''shape''' physics-shape - contact shape.&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;*'''staticcollision''' physics-shape - contact static collision, can be false.&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;*'''rigidbody''' physics-rigid-body - contact rigid body, can be false.&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;==Example==&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;==Example==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;

&lt;!-- diff cache key wiki-wiki_dev_:diff::1.12:old-65141:rev-65143 --&gt;
&lt;/table&gt;</summary>
		<author><name>CrosRoad95</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=PhysicsShapeCast&amp;diff=65141&amp;oldid=prev</id>
		<title>CrosRoad95: Created page with &quot;__NOTOC__  {{Client function}} Tests collision ( like ray cast ) between two position having shape you provided. Remember to let world update before cast, just wait one frame....&quot;</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=PhysicsShapeCast&amp;diff=65141&amp;oldid=prev"/>
		<updated>2020-02-13T20:23:35Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;__NOTOC__  {{Client function}} Tests collision ( like ray cast ) between two position having shape you provided. Remember to let world update before cast, just wait one frame....&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;__NOTOC__ &lt;br /&gt;
{{Client function}}&lt;br /&gt;
Tests collision ( like ray cast ) between two position having shape you provided.&lt;br /&gt;
Remember to let world update before cast, just wait one frame.&lt;br /&gt;
&lt;br /&gt;
==Syntax== &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
table physicsShapeCast(physics-shape theShape, float startX, float startY, float startZ, float endX, float endY, float endZ [ , float startRotationX, float startRotationY, float startRotationZ, float endRotationX, float endRotationY, float endRotationZ ] )             &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
&lt;br /&gt;
===Required Arguments=== &lt;br /&gt;
*'''theShape:''' Primitive shape, supported shapes: &amp;quot;box&amp;quot;, &amp;quot;sphere&amp;quot;, &amp;quot;cone&amp;quot;, &amp;quot;cylinder&amp;quot;&lt;br /&gt;
*'''startXYZ:''' start position.&lt;br /&gt;
*'''endXYZ:''' end position.&lt;br /&gt;
*'''startRotationXYZ:''' start rotation, by default 0,0,0.&lt;br /&gt;
*'''endRotationXYZ:''' end rotation, by default 0,0,0.&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
table with content:&lt;br /&gt;
*'''hit''' boolean - indicate does hit occurs.&lt;br /&gt;
*'''shapeposition''' {x,y,z} - position of shape in moment of contact.&lt;br /&gt;
*'''shaperotation''' {x,y,z} - rotation of shape in moment of contact.&lt;br /&gt;
*'''hitpoint''' {x,y,z} - contact point.&lt;br /&gt;
*'''hitnormal''' {x,y,z} - contact normal vector.&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
&lt;br /&gt;
Creates giant random tetris&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local function dropShapeAtPosition(shape, x,y,z)&lt;br /&gt;
  local result = physicsShapeCast(shape, x,y,z + 1000, x,y,z - 1000)&lt;br /&gt;
  if(result.hit)then&lt;br /&gt;
    local collision = physicsCreateStaticCollision(physics, shape)&lt;br /&gt;
    physicsSetProperties(collision, &amp;quot;position&amp;quot;, result.shapeposition[1], result.shapeposition[2], result.shapeposition[3])&lt;br /&gt;
    physicsSetProperties(collision, &amp;quot;rotation&amp;quot;, result.shaperotation[1], result.shaperotation[2], result.shaperotation[3])&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function tetris()&lt;br /&gt;
  setTimer(function()&lt;br /&gt;
      local box = physicsCreateShape(physics, &amp;quot;box&amp;quot;, math.random() * 5 + 1, math.random() * 5 + 1, math.random() * 2 + 1)&lt;br /&gt;
      dropShapeAtPosition(box, math.random(60),math.random(60),0)&lt;br /&gt;
  end,0,1000)&lt;br /&gt;
end&lt;br /&gt;
tetris()&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
&lt;br /&gt;
{{Client_physics_functions}}&lt;/div&gt;</summary>
		<author><name>CrosRoad95</name></author>
	</entry>
</feed>