hoping someone could explain something about the engine

A place to discuss everything related to Newton Dynamics.

Moderators: Sascha Willems, walaber

hoping someone could explain something about the engine

Postby Sparrow » Mon Nov 19, 2012 1:22 pm

Hi, I came here to see if someone could solve a mystery that's been bugging me about physics engines since I knew about them.

I am busy coding some simple physics just for the fun of it and I need some help. Say an arrow strikes a target, as the arrow penetrates and travels into the target, it decelerates, and the target accelerates. The arrow applies a force on the box, and the box a force on the arrow. This is all fine and well for our minds since we don't work in time steps, but in a physics engine, such as newton, it can't imagine a continuous force and deceleration.

If I had to do a very simple collision I would just do conservation of momentum on both objects, but this doesn't simulate deceleration. If I had to simulate a collision in newton and slow down time, I wouldn't see the objects gradually changing velocity right? It would be an instantaneous change in velocity. But I know for a fact that a physics engine like newton works on a list of forces acting on a body.

can someone tell me what steps the engine takes to solve this? Does it calculate change in kinetic energy? Does it use impulse of a collision? If so, how does it know how long a collision takes to complete? If it works out a force, how does it know how long to apply that force for. And how the hell to these amazing pieces of code keep stacked objects from freaking out, or for that matter even keep an object on a floor from vibrating like crazy due to rounding error from canceling the normal and gravitational?

I don't know exactly how to ask this, but if I'm not being clear I'll happily try and clarify.
Sparrow
 
Posts: 2
Joined: Mon Nov 19, 2012 1:04 pm

Re: hoping someone could explain something about the engine

Postby Julio Jerez » Mon Nov 19, 2012 3:32 pm

Well you put a lot there on the table.
The answer to that is long and complex, basically you need to understand the principles of Virtual force, and the law of conservation of momentum.
For the principle of virtual work, David Baraff has very good papers that are still floating around in the internet. Basically this is the analytical formation for the third law of motion that says for each action there is an equal and opposite reaction. In Virtual Work language this is state as “the work force on a collision are workless”.
Worked is superseded as Force acting over a trajectory. For the work force to be workless the displacement must be zero, but you can think of a zero displacement at a collision by issuing a positive displace along one direction and a equal negative displacement along the same direction.
For a rigid body it happen that the displacing if fix and that set the entire formulation of the rigid body dynamics, because the derivation under those conditions result in what is known as Lagrange Multiplier optimization.
This is not trivial, and you need to know the math first, I submit you to read Baraff papers one and over if you want to get it.
Before I start to make physics libraries, I knew all about Lagragians Dynamics, Virtual work, al lot about Newtonia classical Mechanic, but it was no until I read the 1990 Baradf papers of that I understood how all can be put together into a coherence system when you can add building blocks that all solve specific part and the whole system still works.
As for the detail how the Newton engine implementation of those thing and how it deal with collision impulse and forces at the same time I can post that if you want. What I can tell you is that the engine does no brake any law of Newtonian mechanics.

what are you doing?
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: hoping someone could explain something about the engine

Postby Julio Jerez » Mon Nov 19, 2012 3:39 pm

Sparrow wrote:Say an arrow strikes a target, as the arrow penetrates and travels into the target, it decelerates, and the target accelerates. The arrow applies a force on the box, and the box a force on the arrow. This is all fine and well for our minds since we don't work in time steps, but in a physics engine, such as newton, it can't imagine a continuous force and deceleration.

The one thing I must tell you is that, that probpem is way outside of what a rigid body physics library liek newton can solve.
this can still be solved by the prinsiple by virtual work, but the assution of a rigid body that all points on a body maintaon thier relative possition is not longer valid. therefore the asumtion that that a positive displacement is matched with a equal negative displacement is not valid.
there are formulations where the displacement is aproximated as a linear funtion of some material property and you get a model of stretch and shear inertia for a defomable body, but the equations are very hard to solve because, and in not case practical for real time.
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: hoping someone could explain something about the engine

Postby Sparrow » Mon Nov 19, 2012 9:25 pm

Thanks a lot. I'm going to go look for those papers and read up on virtual force. Can I ask another simple question? If I have a rod that's struck by a ball or something, all linear momentum is conserved, and all angular momentum is conserved, but they have nothing to do with each other right? i.e will the velocity at which the center of mass of the rod travels remain the same regardless of where the ball struck the pole, it will spin faster if it was hit at the tip, but the rod as a whole will move at the same speed a if it was struck in the middle?
Sparrow
 
Posts: 2
Joined: Mon Nov 19, 2012 1:04 pm

Re: hoping someone could explain something about the engine

Postby Sweenie » Tue Nov 20, 2012 4:57 am

I think that topic is discussed in this video...
http://www.youtube.com/watch?v=EOy1NV21pMY&sns=em
At 15:00 minutes into the clip.
Interesting stuff :)
Sweenie
 
Posts: 503
Joined: Mon Jan 24, 2005 7:59 am
Location: Sweden


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 1 guest

cron