<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Maratis forum - How to apply a gravitational force to an object?]]></title>
	<link rel="self" href="http://forum.maratis3d.com/extern.php?action=feed&amp;tid=1121&amp;type=atom"/>
	<updated>2015-04-26T17:39:52Z</updated>
	<generator>PunBB</generator>
	<id>http://forum.maratis3d.com/viewtopic.php?id=1121</id>
		<entry>
			<title type="html"><![CDATA[Re: How to apply a gravitational force to an object?]]></title>
			<link rel="alternate" href="http://forum.maratis3d.com/viewtopic.php?pid=7525#p7525"/>
			<content type="html"><![CDATA[<p>1 - name your objects : &quot;earth&quot; and &quot;player&quot;<br />2 - import the script in the scene :<br /><a href="http://wiki.maratis3d.org/index.php?title=Applying_Scripts_to_objects">http://wiki.maratis3d.org/index.php?tit &#133; to_objects</a></p>]]></content>
			<author>
				<name><![CDATA[anael]]></name>
				<uri>http://forum.maratis3d.com/profile.php?id=2</uri>
			</author>
			<updated>2015-04-26T17:39:52Z</updated>
			<id>http://forum.maratis3d.com/viewtopic.php?pid=7525#p7525</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: How to apply a gravitational force to an object?]]></title>
			<link rel="alternate" href="http://forum.maratis3d.com/viewtopic.php?pid=7524#p7524"/>
			<content type="html"><![CDATA[<p>Heres the project:&nbsp; <a href="https://drive.google.com/folderview?id=0B1qtn8NBqVuxflV6SWFfWUtjQURfbkFzbVlualBabENUZ0dYMG1OQzlTdFd0bzJIMV9hMmc&amp;usp=sharing">https://drive.google.com/folderview?id= &#133; sp=sharing</a></p>]]></content>
			<author>
				<name><![CDATA[blend]]></name>
				<uri>http://forum.maratis3d.com/profile.php?id=1343</uri>
			</author>
			<updated>2015-04-26T13:04:27Z</updated>
			<id>http://forum.maratis3d.com/viewtopic.php?pid=7524#p7524</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: How to apply a gravitational force to an object?]]></title>
			<link rel="alternate" href="http://forum.maratis3d.com/viewtopic.php?pid=7523#p7523"/>
			<content type="html"><![CDATA[<p>It still falls off the side of the earth tho? how do i make the gravity flip?</p>]]></content>
			<author>
				<name><![CDATA[blend]]></name>
				<uri>http://forum.maratis3d.com/profile.php?id=1343</uri>
			</author>
			<updated>2015-04-26T12:52:42Z</updated>
			<id>http://forum.maratis3d.com/viewtopic.php?pid=7523#p7523</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: How to apply a gravitational force to an object?]]></title>
			<link rel="alternate" href="http://forum.maratis3d.com/viewtopic.php?pid=7522#p7522"/>
			<content type="html"><![CDATA[<p>Thanks very much anael. this help me understand vectors better.</p>]]></content>
			<author>
				<name><![CDATA[blend]]></name>
				<uri>http://forum.maratis3d.com/profile.php?id=1343</uri>
			</author>
			<updated>2015-04-26T12:25:25Z</updated>
			<id>http://forum.maratis3d.com/viewtopic.php?pid=7522#p7522</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: How to apply a gravitational force to an object?]]></title>
			<link rel="alternate" href="http://forum.maratis3d.com/viewtopic.php?pid=7521#p7521"/>
			<content type="html"><![CDATA[<p>but be sure the origin of hearth and player are centered in the mesh</p>]]></content>
			<author>
				<name><![CDATA[anael]]></name>
				<uri>http://forum.maratis3d.com/profile.php?id=2</uri>
			</author>
			<updated>2015-04-26T12:16:28Z</updated>
			<id>http://forum.maratis3d.com/viewtopic.php?pid=7521#p7521</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: How to apply a gravitational force to an object?]]></title>
			<link rel="alternate" href="http://forum.maratis3d.com/viewtopic.php?pid=7520#p7520"/>
			<content type="html"><![CDATA[<p>you need a direction vector, in your code it&#039;s all zero.</p><div class="codebox"><pre><code>-- get objects
player = getObject(&quot;player&quot;)
earth = getObject(&quot;earth&quot;)

setGravity({0, 0, 0}) -- set current scene gravity to zero

g = 0.98 -- your new hand made gravity force

-- scene update
function onSceneUpdate()
   
    vec = normalize(getPosition(earth) - getPosition(player)) * g
    addCentralForce(player, vec)
    
end</code></pre></div>]]></content>
			<author>
				<name><![CDATA[anael]]></name>
				<uri>http://forum.maratis3d.com/profile.php?id=2</uri>
			</author>
			<updated>2015-04-26T12:15:08Z</updated>
			<id>http://forum.maratis3d.com/viewtopic.php?pid=7520#p7520</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: How to apply a gravitational force to an object?]]></title>
			<link rel="alternate" href="http://forum.maratis3d.com/viewtopic.php?pid=7519#p7519"/>
			<content type="html"><![CDATA[<p>This is what i have but cant get it to work.</p><br /><p>-- get objects<br />player = getObject(&quot;player&quot;)<br />earth= getObject(&quot;earth&quot;)</p><br /><p>-- scene update<br />function onSceneUpdate()</p><p>&nbsp; &nbsp; gravity = {0, 0, 0}<br />&nbsp; &nbsp; setGravity(gravity) -- set current scene gravity<br />&nbsp; &nbsp; <br />&nbsp; &nbsp; addCentralForce(earth, {0, 0, 0}, &quot;local&quot;)<br />&nbsp; &nbsp; end<br />&nbsp; &nbsp; <br />end</p>]]></content>
			<author>
				<name><![CDATA[blend]]></name>
				<uri>http://forum.maratis3d.com/profile.php?id=1343</uri>
			</author>
			<updated>2015-04-26T11:33:40Z</updated>
			<id>http://forum.maratis3d.com/viewtopic.php?pid=7519#p7519</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: How to apply a gravitational force to an object?]]></title>
			<link rel="alternate" href="http://forum.maratis3d.com/viewtopic.php?pid=7518#p7518"/>
			<content type="html"><![CDATA[<p>well, you can first set the gravity to zero with setGravity :<br /><a href="http://wiki.maratis3d.org/index.php?title=SetGravity">http://wiki.maratis3d.org/index.php?title=SetGravity</a></p><p>and then at each frame add a central force with a vector going from the object to the center of the sphere.<br />with addCentralForce : <a href="http://wiki.maratis3d.org/index.php?title=AddCentralForce">http://wiki.maratis3d.org/index.php?tit &#133; ntralForce</a></p>]]></content>
			<author>
				<name><![CDATA[anael]]></name>
				<uri>http://forum.maratis3d.com/profile.php?id=2</uri>
			</author>
			<updated>2015-04-26T09:36:15Z</updated>
			<id>http://forum.maratis3d.com/viewtopic.php?pid=7518#p7518</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[How to apply a gravitational force to an object?]]></title>
			<link rel="alternate" href="http://forum.maratis3d.com/viewtopic.php?pid=7517#p7517"/>
			<content type="html"><![CDATA[<p>How to apply a gravitational force to an object? i want to make a sphere and the player walk 360 around it?</p>]]></content>
			<author>
				<name><![CDATA[blend]]></name>
				<uri>http://forum.maratis3d.com/profile.php?id=1343</uri>
			</author>
			<updated>2015-04-25T10:30:13Z</updated>
			<id>http://forum.maratis3d.com/viewtopic.php?pid=7517#p7517</id>
		</entry>
</feed>
