<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Maratis forum - problems with ray using c ++]]></title>
	<link rel="self" href="http://forum.maratis3d.com/extern.php?action=feed&amp;tid=1116&amp;type=atom"/>
	<updated>2015-03-29T01:19:56Z</updated>
	<generator>PunBB</generator>
	<id>http://forum.maratis3d.com/viewtopic.php?id=1116</id>
		<entry>
			<title type="html"><![CDATA[Re: problems with ray using c ++]]></title>
			<link rel="alternate" href="http://forum.maratis3d.com/viewtopic.php?pid=7488#p7488"/>
			<content type="html"><![CDATA[<p>collision objects are created during MScene::begin automatically,<br />to add collision objects later on, you need to do it manually.</p><p>Normally you can call this to create the collision object of an entity if it was not done at scene begin (call it only once, it is not checking if it was already done) :</p><div class="codebox"><pre><code>scene-&gt;prepareCollisionShape(entity);
scene-&gt;prepareCollisionObject(entity);
scene-&gt;prepareConstraints(entity);</code></pre></div>]]></content>
			<author>
				<name><![CDATA[anael]]></name>
				<uri>http://forum.maratis3d.com/profile.php?id=2</uri>
			</author>
			<updated>2015-03-29T01:19:56Z</updated>
			<id>http://forum.maratis3d.com/viewtopic.php?pid=7488#p7488</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: problems with ray using c ++]]></title>
			<link rel="alternate" href="http://forum.maratis3d.com/viewtopic.php?pid=7487#p7487"/>
			<content type="html"><![CDATA[<p>Thanks for your help Anael. I have other question: why doesn´t work the object’s physical simulation when I active their physical properties after the scene is loaded in the Update () function?</p>]]></content>
			<author>
				<name><![CDATA[ArielRiv]]></name>
				<uri>http://forum.maratis3d.com/profile.php?id=2860</uri>
			</author>
			<updated>2015-03-27T20:06:12Z</updated>
			<id>http://forum.maratis3d.com/viewtopic.php?pid=7487#p7487</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: problems with ray using c ++]]></title>
			<link rel="alternate" href="http://forum.maratis3d.com/viewtopic.php?pid=7485#p7485"/>
			<content type="html"><![CDATA[<p>Hi,</p><p>getUnProjectedPoint is low level, you need to give exact pixel position in viewport space.<br />If you are in full screen, by multiplying by the screen size + reversing y coordinates :</p><div class="codebox"><pre><code>MSystemContext * system = engine-&gt;getSystemContext();
    
unsigned int width = 0;
unsigned int height = 0;
system-&gt;getScreenSize(&amp;width, &amp;height);

x = x * width;
y = (1.0f - y) * height;</code></pre></div><p>In lua it&#039;s done transparently.</p>]]></content>
			<author>
				<name><![CDATA[anael]]></name>
				<uri>http://forum.maratis3d.com/profile.php?id=2</uri>
			</author>
			<updated>2015-03-27T14:33:23Z</updated>
			<id>http://forum.maratis3d.com/viewtopic.php?pid=7485#p7485</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[problems with ray using c ++]]></title>
			<link rel="alternate" href="http://forum.maratis3d.com/viewtopic.php?pid=7484#p7484"/>
			<content type="html"><![CDATA[<p>I wanna work with maratis SDK following the example of the engine manual use, I&#039;m trying to make a ray to know on top of which object is the mouse placed regarding what IsRayHit() function does which always returns false instead of detecting the object, I leave you the code&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; float x = input-&gt;getAxis(&quot;MOUSE_X&quot;);<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; float y = input-&gt;getAxis(&quot;MOUSE_Y&quot;);</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; MVector3 vi = camera-&gt;getUnProjectedPoint(MVector3(x,y,0));<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; MVector3 vo = camera-&gt;getUnProjectedPoint(MVector3(x,y,1));</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //cout&lt;&lt;&quot; &quot;&lt;&lt;vo.x&lt;&lt;&quot; &quot;&lt;&lt;vo.y&lt;&lt;&quot; &quot;&lt;&lt;vo.z&lt;&lt;endl;</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if(physics-&gt;isRayHit(vi, vo, &amp;collisionObjId, &amp;point)){<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; exit(0);<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //cout&lt;&lt;point.x&lt;&lt;&quot;&nbsp; &quot;&lt;&lt;point.y&lt;&lt;&quot;&nbsp; &nbsp;&quot;&lt;&lt;point.z&lt;&lt;endl;</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; MOEntity * entity = scene-&gt;getEntityByName(&quot;monkey&quot;);<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; MPhysicsProperties * phyProps = entity-&gt;getPhysicsProperties();</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cout&lt;&lt;phyProps-&gt;getCollisionObjectId()&lt;&lt;endl;</p><p>The object has a physical property active, but the ray is not detecting it</p>]]></content>
			<author>
				<name><![CDATA[ArielRiv]]></name>
				<uri>http://forum.maratis3d.com/profile.php?id=2860</uri>
			</author>
			<updated>2015-03-26T16:41:30Z</updated>
			<id>http://forum.maratis3d.com/viewtopic.php?pid=7484#p7484</id>
		</entry>
</feed>
