<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Physics in 3D</title>
	<atom:link href="http://gafferongames.com/game-physics/physics-in-3d/feed/" rel="self" type="application/rss+xml" />
	<link>http://gafferongames.com</link>
	<description>Glenn Fiedler&#039;s Game Development Articles and Tutorials</description>
	<lastBuildDate>Tue, 07 Sep 2010 17:03:11 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Glenn Fiedler</title>
		<link>http://gafferongames.com/game-physics/physics-in-3d/#comment-438</link>
		<dc:creator>Glenn Fiedler</dc:creator>
		<pubDate>Sat, 08 May 2010 05:48:01 +0000</pubDate>
		<guid isPermaLink="false">http://www.gaffer.org/wordpress/physics-in-3d/#comment-438</guid>
		<description>Looks like you are right, sorry about that</description>
		<content:encoded><![CDATA[<p>Looks like you are right, sorry about that</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Olai</title>
		<link>http://gafferongames.com/game-physics/physics-in-3d/#comment-437</link>
		<dc:creator>Olai</dc:creator>
		<pubDate>Sat, 01 May 2010 14:12:54 +0000</pubDate>
		<guid isPermaLink="false">http://www.gaffer.org/wordpress/physics-in-3d/#comment-437</guid>
		<description>I noticed that you defined torque with switched point offset and force. It should be T = p x F, not T = F x p, which leads to a torque in the reverse and wrong direction.</description>
		<content:encoded><![CDATA[<p>I noticed that you defined torque with switched point offset and force. It should be T = p x F, not T = F x p, which leads to a torque in the reverse and wrong direction.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Thijs Adriaansen</title>
		<link>http://gafferongames.com/game-physics/physics-in-3d/#comment-436</link>
		<dc:creator>Thijs Adriaansen</dc:creator>
		<pubDate>Sun, 29 Nov 2009 17:14:20 +0000</pubDate>
		<guid isPermaLink="false">http://www.gaffer.org/wordpress/physics-in-3d/#comment-436</guid>
		<description>Thank you for the reply,

now I understand why the object moves along the axis while rotating. I also read the first &#039;x&#039; in Ftorque = F x (p - x) as the x-position not the cross product symbol x.</description>
		<content:encoded><![CDATA[<p>Thank you for the reply,</p>
<p>now I understand why the object moves along the axis while rotating. I also read the first &#8216;x&#8217; in Ftorque = F x (p &#8211; x) as the x-position not the cross product symbol x.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Glenn Fiedler</title>
		<link>http://gafferongames.com/game-physics/physics-in-3d/#comment-435</link>
		<dc:creator>Glenn Fiedler</dc:creator>
		<pubDate>Fri, 27 Nov 2009 17:35:22 +0000</pubDate>
		<guid isPermaLink="false">http://www.gaffer.org/wordpress/physics-in-3d/#comment-435</guid>
		<description>actually, the forces are not constant over the frame because they depend on the position and velocity of the body - this is why i use RK4...</description>
		<content:encoded><![CDATA[<p>actually, the forces are not constant over the frame because they depend on the position and velocity of the body &#8211; this is why i use RK4&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Glenn Fiedler</title>
		<link>http://gafferongames.com/game-physics/physics-in-3d/#comment-434</link>
		<dc:creator>Glenn Fiedler</dc:creator>
		<pubDate>Fri, 27 Nov 2009 17:34:01 +0000</pubDate>
		<guid isPermaLink="false">http://www.gaffer.org/wordpress/physics-in-3d/#comment-434</guid>
		<description>ps. If you only want to rotate around the z-axis you would just apply a linear force to counteract the linear component of the force you apply, or to apply the torque directly (it has no linear component, by definition).</description>
		<content:encoded><![CDATA[<p>ps. If you only want to rotate around the z-axis you would just apply a linear force to counteract the linear component of the force you apply, or to apply the torque directly (it has no linear component, by definition).</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Glenn Fiedler</title>
		<link>http://gafferongames.com/game-physics/physics-in-3d/#comment-433</link>
		<dc:creator>Glenn Fiedler</dc:creator>
		<pubDate>Fri, 27 Nov 2009 17:32:21 +0000</pubDate>
		<guid isPermaLink="false">http://www.gaffer.org/wordpress/physics-in-3d/#comment-433</guid>
		<description>It depends entirely on what you want to achieve. But yes, you generally apply damping to both linear and angular motion</description>
		<content:encoded><![CDATA[<p>It depends entirely on what you want to achieve. But yes, you generally apply damping to both linear and angular motion</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Thijs Adriaansen</title>
		<link>http://gafferongames.com/game-physics/physics-in-3d/#comment-432</link>
		<dc:creator>Thijs Adriaansen</dc:creator>
		<pubDate>Fri, 27 Nov 2009 15:21:18 +0000</pubDate>
		<guid isPermaLink="false">http://www.gaffer.org/wordpress/physics-in-3d/#comment-432</guid>
		<description>I have a question about applying forces. Do you apply a different force for the torque and the linear force?

In this equation:
Flinear = F
Ftorque = F x (p - x)

If for example you apply a force along the z-axis, the box would rotate around the z-axis and move along the z-axis. But we would only want to rotate around the z-axis. So do you have to dampen the Flinear?</description>
		<content:encoded><![CDATA[<p>I have a question about applying forces. Do you apply a different force for the torque and the linear force?</p>
<p>In this equation:<br />
Flinear = F<br />
Ftorque = F x (p &#8211; x)</p>
<p>If for example you apply a force along the z-axis, the box would rotate around the z-axis and move along the z-axis. But we would only want to rotate around the z-axis. So do you have to dampen the Flinear?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Wouter Buddingh'</title>
		<link>http://gafferongames.com/game-physics/physics-in-3d/#comment-431</link>
		<dc:creator>Wouter Buddingh'</dc:creator>
		<pubDate>Mon, 02 Feb 2009 22:55:29 +0000</pubDate>
		<guid isPermaLink="false">http://www.gaffer.org/wordpress/physics-in-3d/#comment-431</guid>
		<description>Today, i finished a 3D demo which uses a third order polynomial to integrate paths of objects.

You can find it at:

http://www.wouterbuddingh.nl/index.php?page=projecten/physics/physics.php

The simulation has an integration step of 1/100th of a second. There is no friction between objects, and no torque is applied to the spheres.</description>
		<content:encoded><![CDATA[<p>Today, i finished a 3D demo which uses a third order polynomial to integrate paths of objects.</p>
<p>You can find it at:</p>
<p><a href="http://www.wouterbuddingh.nl/index.php?page=projecten/physics/physics.php" rel="nofollow">http://www.wouterbuddingh.nl/index.php?page=projecten/physics/physics.php</a></p>
<p>The simulation has an integration step of 1/100th of a second. There is no friction between objects, and no torque is applied to the spheres.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Wouter Buddingh'</title>
		<link>http://gafferongames.com/game-physics/physics-in-3d/#comment-430</link>
		<dc:creator>Wouter Buddingh'</dc:creator>
		<pubDate>Wed, 28 Jan 2009 01:21:12 +0000</pubDate>
		<guid isPermaLink="false">http://www.gaffer.org/wordpress/physics-in-3d/#comment-430</guid>
		<description>I think an RK4 integrator (like it is implementented in for example your &quot;PhysicsIn3D&quot; demo ) is a good way to approximate the integral of any function, no matter the complexity.

My understanding of RK4 is based on this picture:

http://rainman.astro.uiuc.edu/ddr/ddr-galaxy/pics/rk4.JPG

The picture clearly suggests that you need derivatives of the function. These derivatives are used in your &quot;PhysicsIn3D demo&quot;.

A also looked at your &quot;Networked Physics&quot; demo. This is a more real life example of a computer simulation (or game). Forces that are applied during the frame are unknown. The function &quot;forces&quot;, takes no time argument. This is because these forces are applied once per frame. Because the acceleration is constant, you cannot do better than a 2nd degree Maclaurin polynomial. I actually think your implementation in Network Physics is equivalent to a 2nd degree Maclaurin polynomial, although i haven&#039;t proved it. If you would add (subframe) time dependent functions to the forces function, then an RK4 implementation is better.

My program looks a bit like Networked Physics. I used a Maclaurin polynomial because it is much easier to implement.

Today i created a solution to the inaccuracy of the acceleration. Normally, the acceleration is constant during a frame. There is no information about the curvature of the acceleration.

I used a simple trick, to get a better estimation of the acceleration function. In my previous post, i suggested a quadratic extrapolation. Today, i used a linear one, which works fine.

the acceleration is defined as follows:

(da/dt) = ((acceleration current frame) - (acceleration previous frame))/timestep.

a(t) = a(0) + t * (da/dt)

{Let&#039;s assume the frame ranges from 0 to 1, timestep = 1}

An example on how this will cause the simulation to behave:


t=0:acceleration is zero

t=1:{here we begin, because the algorighm needs a prev state}
set acceleration 10 (a correct value)
End of frame: acceleration = 20 (10 + (10 - 0))
t = 2 {the value of acceleration is discarded because the correct value of acceleration is known)
acceleration = correct value (accumulated by algorithms before the integration step)

This linear prediction is better than assuming that the acceleration does not change.

The reason i think this, is because i tested it.

Test:
A sphere lies on a plane. Gravity is pulling the sphere down. The ground uses &quot;penalty&quot; forces to keep the sphere on the surface. In a perfect simulation, the sphere would lay still on the plane. It might sink a little bit, but it should be resting.

In an imperfect numeric simulation, the sphere would be to far inside the ground. Therefor the penalty forces would become too large (depth dependent) and the sphere would bounce.

I tested the algorithm with a constant force and with the linear estimated force.

The test statistic was the maximum height of bouncing achieved after 20 seconds.

The constant acceleration scored a value of 6.71736.
The linear estimation scored a value of 0,0162495.

This is just one way of testing the integrator. I implemented some springs, and they look fine too.

Both of the integrator&#039;s used Maclaurin polynomials. The constant a 2nd degree, and the linear a third degree.

You can do the same trick with Runge Kutta 4 too.

Reviewing the first part of this post; when you only have constant acceleration, your function is shaped like a 2nd degree polynomial. The solution is a Maclaurin polynomial. No matter how you average subderivatives, you cannot do better than the analytical solution.


Greetings</description>
		<content:encoded><![CDATA[<p>I think an RK4 integrator (like it is implementented in for example your &#8220;PhysicsIn3D&#8221; demo ) is a good way to approximate the integral of any function, no matter the complexity.</p>
<p>My understanding of RK4 is based on this picture:</p>
<p><a href="http://rainman.astro.uiuc.edu/ddr/ddr-galaxy/pics/rk4.JPG" rel="nofollow">http://rainman.astro.uiuc.edu/ddr/ddr-galaxy/pics/rk4.JPG</a></p>
<p>The picture clearly suggests that you need derivatives of the function. These derivatives are used in your &#8220;PhysicsIn3D demo&#8221;.</p>
<p>A also looked at your &#8220;Networked Physics&#8221; demo. This is a more real life example of a computer simulation (or game). Forces that are applied during the frame are unknown. The function &#8220;forces&#8221;, takes no time argument. This is because these forces are applied once per frame. Because the acceleration is constant, you cannot do better than a 2nd degree Maclaurin polynomial. I actually think your implementation in Network Physics is equivalent to a 2nd degree Maclaurin polynomial, although i haven&#8217;t proved it. If you would add (subframe) time dependent functions to the forces function, then an RK4 implementation is better.</p>
<p>My program looks a bit like Networked Physics. I used a Maclaurin polynomial because it is much easier to implement.</p>
<p>Today i created a solution to the inaccuracy of the acceleration. Normally, the acceleration is constant during a frame. There is no information about the curvature of the acceleration.</p>
<p>I used a simple trick, to get a better estimation of the acceleration function. In my previous post, i suggested a quadratic extrapolation. Today, i used a linear one, which works fine.</p>
<p>the acceleration is defined as follows:</p>
<p>(da/dt) = ((acceleration current frame) &#8211; (acceleration previous frame))/timestep.</p>
<p>a(t) = a(0) + t * (da/dt)</p>
<p>{Let&#8217;s assume the frame ranges from 0 to 1, timestep = 1}</p>
<p>An example on how this will cause the simulation to behave:</p>
<p>t=0:acceleration is zero</p>
<p>t=1:{here we begin, because the algorighm needs a prev state}<br />
set acceleration 10 (a correct value)<br />
End of frame: acceleration = 20 (10 + (10 &#8211; 0))<br />
t = 2 {the value of acceleration is discarded because the correct value of acceleration is known)<br />
acceleration = correct value (accumulated by algorithms before the integration step)</p>
<p>This linear prediction is better than assuming that the acceleration does not change.</p>
<p>The reason i think this, is because i tested it.</p>
<p>Test:<br />
A sphere lies on a plane. Gravity is pulling the sphere down. The ground uses &#8220;penalty&#8221; forces to keep the sphere on the surface. In a perfect simulation, the sphere would lay still on the plane. It might sink a little bit, but it should be resting.</p>
<p>In an imperfect numeric simulation, the sphere would be to far inside the ground. Therefor the penalty forces would become too large (depth dependent) and the sphere would bounce.</p>
<p>I tested the algorithm with a constant force and with the linear estimated force.</p>
<p>The test statistic was the maximum height of bouncing achieved after 20 seconds.</p>
<p>The constant acceleration scored a value of 6.71736.<br />
The linear estimation scored a value of 0,0162495.</p>
<p>This is just one way of testing the integrator. I implemented some springs, and they look fine too.</p>
<p>Both of the integrator&#8217;s used Maclaurin polynomials. The constant a 2nd degree, and the linear a third degree.</p>
<p>You can do the same trick with Runge Kutta 4 too.</p>
<p>Reviewing the first part of this post; when you only have constant acceleration, your function is shaped like a 2nd degree polynomial. The solution is a Maclaurin polynomial. No matter how you average subderivatives, you cannot do better than the analytical solution.</p>
<p>Greetings</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Glenn Fiedler</title>
		<link>http://gafferongames.com/game-physics/physics-in-3d/#comment-429</link>
		<dc:creator>Glenn Fiedler</dc:creator>
		<pubDate>Tue, 27 Jan 2009 18:12:59 +0000</pubDate>
		<guid isPermaLink="false">http://www.gaffer.org/wordpress/physics-in-3d/#comment-429</guid>
		<description>i&#039;m not 100% sure, but what you are proposing sounds awfully a lot like reinventing RK4

RK4 is built on top of a taylor&#039;s series expansion, the trick is that since you don&#039;t know the derivatives of the function, it samples the function 4 times per-timestep to approximate them

these approximations are good enough to get the order of the error down to order 5</description>
		<content:encoded><![CDATA[<p>i&#8217;m not 100% sure, but what you are proposing sounds awfully a lot like reinventing RK4</p>
<p>RK4 is built on top of a taylor&#8217;s series expansion, the trick is that since you don&#8217;t know the derivatives of the function, it samples the function 4 times per-timestep to approximate them</p>
<p>these approximations are good enough to get the order of the error down to order 5</p>
]]></content:encoded>
	</item>
</channel>
</rss>
