About platform physics test01

Here comes some comments about the platform physics test01.

About jumping:

My first idea was to apply an impulse for jumping the character. This would however break Newton’s third law of motion (action-reaction) which isn’t really a problem as long as the ground is all static. But since I wanted my character to run around and jump from movable objects (like the rope bridge) and I wanted the bridge to be affected by the impulse as well I could not use a single impulse. Instead I created a compressed spring between the character and the ground object for a short time period.

About collission:

The problem with inCollision is that two objects in contact in reality keep bouncing against each other which makes the onCollision being called every other update. Therefore the onCollision event has the be smoothed out over several updates. I think I saw some discussions about these in the forum at http://www.codeplex.com/FarseerPhysics

About gravity:

The gravity is applied by, for each object looping through every other object and calculating the resulting gravity force between them, like this:

foreach body1
   gravity=0
   foreach body2 != this
      gravity += G*m1*m2/r^2
   end
 body1.addforce(gravity)
 end

where G is a constant, m1 is the mass of body1, m2 the mass of body2 and r is the distance between them.

http://en.wikipedia.org/wiki/Newton%27s_law_of_universal_gravitation

Related posts:

  1. Fun-Motion Physics Games En intressant sida med en mängd fysikrelaterade spel att ladda...
  2. Same Physics Ett roligt flashspel med fysikinslag är Same Physics....
Detta inlägg är publicerat i Physics och taggat . Bokmärk permalink. Skriv en kommentar eller lämna en trackback: Trackback URL.

Skriv en kommentar

Din epostadress delas eller publiceras aldrig Obligatoriska fält är markerade med *

*
*

Du kan använda dessa HTML-taggar och attribut: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

 
  • Ads