<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
	<channel>
		<title><![CDATA[Maratis forum - Adding gravity to a planet]]></title>
		<link>http://forum.maratis3d.com/viewtopic.php?id=508</link>
		<description><![CDATA[The most recent posts in Adding gravity to a planet.]]></description>
		<lastBuildDate>Mon, 31 Dec 2012 01:08:58 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: Adding gravity to a planet]]></title>
			<link>http://forum.maratis3d.com/viewtopic.php?pid=3135#p3135</link>
			<description><![CDATA[<p>Thanks. <img src="http://forum.maratis3d.com/img/smilies/smile.png" width="15" height="15" alt="smile" /></p>]]></description>
			<author><![CDATA[dummy@example.com (Pär)]]></author>
			<pubDate>Mon, 31 Dec 2012 01:08:58 +0000</pubDate>
			<guid>http://forum.maratis3d.com/viewtopic.php?pid=3135#p3135</guid>
		</item>
		<item>
			<title><![CDATA[Re: Adding gravity to a planet]]></title>
			<link>http://forum.maratis3d.com/viewtopic.php?pid=3127#p3127</link>
			<description><![CDATA[<p>I think it&#039;s the reverse, and not local :</p><div class="codebox"><pre><code>force = {corepos[1] - playerpos[1], corepos[2] - playerpos[2], corepos[3] - playerpos[3]}


addCentralForce(player, force)</code></pre></div><p>you also might need to normalize the force vector :</p><div class="codebox"><pre><code>function getLength3d(vec)

    return math.sqrt(vec[1]*vec[1] + vec[2]*vec[2] + vec[3]*vec[3])

end

function normalize3d(vec)

    length = getLength3d(vec)
    vec[1] = vec[1] / length
    vec[2] = vec[2] / length
    vec[3] = vec[3] / length
    return vec

end</code></pre></div>]]></description>
			<author><![CDATA[dummy@example.com (anael)]]></author>
			<pubDate>Sun, 30 Dec 2012 10:30:49 +0000</pubDate>
			<guid>http://forum.maratis3d.com/viewtopic.php?pid=3127#p3127</guid>
		</item>
		<item>
			<title><![CDATA[Re: Adding gravity to a planet]]></title>
			<link>http://forum.maratis3d.com/viewtopic.php?pid=3124#p3124</link>
			<description><![CDATA[<p>playerpos = getPosition(player)<br />&nbsp; &nbsp; <br />&nbsp; &nbsp; corepos = getPosition(core)<br />&nbsp; &nbsp; <br />&nbsp; &nbsp;&nbsp; &nbsp;gravity = {0, 0, 0}<br />&nbsp; &nbsp; <br />&nbsp; &nbsp; addCentralForce(player, {playerpos[1] - corepos[1], playerpos[2] - corepos[2], playerpos[3] - corepos[3]}, &quot;local&quot;)<br />&nbsp; &nbsp; </p><p>Like this?</p>]]></description>
			<author><![CDATA[dummy@example.com (Pär)]]></author>
			<pubDate>Sun, 30 Dec 2012 00:00:27 +0000</pubDate>
			<guid>http://forum.maratis3d.com/viewtopic.php?pid=3124#p3124</guid>
		</item>
		<item>
			<title><![CDATA[Re: Adding gravity to a planet]]></title>
			<link>http://forum.maratis3d.com/viewtopic.php?pid=3123#p3123</link>
			<description><![CDATA[<p>set the gravity to zero, set the objects physics and use &quot;addCentralForce&quot; :<br /><a href="http://wiki.maratis3d.org/index.php?title=AddCentralForce">http://wiki.maratis3d.org/index.php?tit &#133; ntralForce</a></p>]]></description>
			<author><![CDATA[dummy@example.com (anael)]]></author>
			<pubDate>Sat, 29 Dec 2012 23:29:31 +0000</pubDate>
			<guid>http://forum.maratis3d.com/viewtopic.php?pid=3123#p3123</guid>
		</item>
		<item>
			<title><![CDATA[Adding gravity to a planet]]></title>
			<link>http://forum.maratis3d.com/viewtopic.php?pid=3122#p3122</link>
			<description><![CDATA[<p>Hey! Now I&#039;m doing a script for planetary gravity.</p><p>&nbsp; &nbsp; core = getObject(core)<br />&nbsp; &nbsp; planet = getObject(planet)<br />&nbsp; &nbsp; player = getObject(player)</p><br /><br /><p>&nbsp; &nbsp; playerpos = getPosition(player)<br />&nbsp; &nbsp; <br />&nbsp; &nbsp; corepos = getPosition(core)<br />&nbsp; &nbsp; <br />&nbsp; &nbsp; gravity = {playerpos[1] - corepos[1], playerpos[2] - corepos[2], playerpos[3] - corepos[3]}</p><p>Thinking that the player will be drawn to the core of the planet by subtracting there co-ordinates all the time, and that the physics-enabled-planet will provide ground to collide with.</p><p>This is my idea, but it doesn&#039;t work.</p>]]></description>
			<author><![CDATA[dummy@example.com (Pär)]]></author>
			<pubDate>Sat, 29 Dec 2012 23:05:59 +0000</pubDate>
			<guid>http://forum.maratis3d.com/viewtopic.php?pid=3122#p3122</guid>
		</item>
	</channel>
</rss>
