Archived

This topic is now archived and is closed to further replies.

Aph3x

Weight in physics calcs

Recommended Posts

Hi all, I''m simulating a projectile''s flight in my engine to the level of including air density etc. Just wondered where the object''s weight comes into play? I know it affects the downward force (W=m*G), but how is it accounted for? I''m thinking that just applying it to the gravity term would make a heavier object fall faster than a light one, which I think is wrong..?

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
If you drop two objects on earth from the same height, they will fall in the exact same way with the same acceleration and velocity assuming of course that there is no drag. Basically, since F=ma, and a due to gravity is the same at the heights above the earth you will be looking at, gravity exerts equal force on all falling objects. That does not mean equal energy gain, however. In physics, there is something we do called making a free-body diagram, which basically maps out all of the forces acting on an object and which directions the force vectors are in. From that diagram, you can get an idea of how to resolve the force vectors into their x and y components, which is what you need to calculate the total force in the x and y directions. Basically, when you draw a free-body diagram for a projectile, the force due to gravity points straight down from the center of gravity. The drag force will affect both the x and y components; how it affects them depends on how you implement the drag. Drag is tricky.

--Garibaldi

Share this post


Link to post
Share on other sites
I'm using an origin point mass (not going to the rigid body level here!)
I'm including drag as:

const float speed = mVelocity.Length(); // Assumes no wind.
const float dragForce = 0.5f * KRocketDragCoefficient * KAirDensityRho * (speed*speed); // Ignoring cross-sectional area.
mVelocity -= mVelocity * dragForce;


[edited by - aph3x on May 27, 2004 12:33:15 PM]

Share this post


Link to post
Share on other sites
Sorry I did not know what projectile means

usng 3D vectors:

sumforce=vector(0,0,0)
sumforce+=-abs(dragforce)*unitvelocitydirectionvector
sumforce+=vector(0,0,-mass*9.81)
//euler:

acceleraionvector = sumforce / mass
positionvector += velocityvector * dt
velocityvector += accelerationvector * dt


You must first sum all the force vectors acting on the object, and then calculate acceleration, velocity, and position

Share this post


Link to post
Share on other sites
quote:
Original post by szinkopa
sumforce+=-abs(dragforce)*unitvelocitydirectionvector
sumforce+=vector(0,0,-mass*9.81)



lol - language barriers strike again.

Ah, of course, the velocity direction vector should be normalised, doh!



[edited by - aph3x on May 27, 2004 1:23:49 PM]

Share this post


Link to post
Share on other sites
Use the weight as just another force acting on the object. (downward). It''s true everything falls at the same speed in a vacuum, but not with air resistance.
So pretty much all you need to do is acceleration = netForce / mass;
so if you had a 10kg object, and 9.8m/s acceleration, the weight is 98N. If its falling straight down at some instant and the drag force is 50N, the netForce will be 48N.
then Accell = 48 / 10kg = 4.8 m/s^2.

Compare that to an object of 20kg. Weight is now 196N. If the drag force is still 50N the netForce will be 119N.
Accel = 119 / 20 = 5.95 m/s^2.

So you see, a heavier object DOES fall faster when air resistance is present, as the force pushing downward will be fractionally larger in comparison to the frictional forces.

You really dont need to know the details, just sum up all your forces, divide by mass, and apply the acceleration. That''s alot of the point of simulators in the end... to help visualize things that may not be intuitive.

Share this post


Link to post
Share on other sites
quote:
Original post by szinkopa
-some nice source-

You must first sum all the force vectors acting on the object, and then calculate acceleration, velocity, and position

Aha, I was just using a precalced GravitySpeed * timeDelta, not adding mass in there.
quote:
Original post by Garibaldi
- a nice description-


quote:
Original post by CombatWombat
-a nice expansion on the nice description-


It's making even more sense now, thanks Gari/CW

As for visualisation, I just made my engine draw all the vectors in question and that helps nicely!

[edited by - Aph3x on May 27, 2004 3:33:23 PM]

Share this post


Link to post
Share on other sites
And to apply thrust I think:


if (mFuel > 0)
{
// Add thrust.

forceSum += mDirection * (KRocketThrustFactor / KRocketMass);
// Fake lift here for now.

forceSum.mY += KRocketMass*KGravitySpeed;
}


before the integration is ok?
Seems to work ok in my tests

[edited by - aph3x on May 28, 2004 6:27:01 AM]

Share this post


Link to post
Share on other sites
Or should that be:

// Add thrust.
forceSum += mDirection * (KRocketThrustFactor / (KRocketMass*9.8f));

??!

Argh!?


[edited by - aph3x on May 28, 2004 7:38:20 AM]

Share this post


Link to post
Share on other sites
Are you simulating a rocket in the space?

Then first you should look up the formula, that describes the motion of a rocket. As far asI know it moves because of the conservation of momentum. The fuel goes out with some speed, this means a momentum, that impule will be applied to the rocket (whose mass is decreasing beacuse the fuel is going out) in the opposite direction.
The force is the derivative of the impulse or lin. momentum.
I think the equation of motion of a rocket contaions no force, just lin. momentum. But it (the formula) can be derivated, so you get force.
Google for it.

Share this post


Link to post
Share on other sites
I'm writing a class to do projectile and 'powered projectile' (which I call a rocket, but isn't a 'classical' rocket) movement through air.
I wasn't going to bother modelling the weight change of expelled fuel.

/me googles some more...

OK found some rocket stuff: jeez, it looks horrible!
I just wanna simulate the effect with a thrust force I'm thinking 8o

[edited by - aph3x on May 28, 2004 9:05:44 AM]

Share this post


Link to post
Share on other sites
Add your thrust force to all the other forces, then integrate.

NetForce = gravityForce + ThrustForce + dragForce + anyOtherHappyForces; (all vectors)
Acceleration = NetForce / Mass;

Integrate to get position and velocity.
Also you could start looking into more advanced integration methods (Rk2, Rk4, etc), since your model is still fairly simple. You'll thank yourself later when you try to make a car sim or something, hah.

edit: alternately, you could make some kind of 'body' class that has a function like
AddForce(vector position, vector force)
{
netForce += force;
netTorque += (distance from position to the centerofmass of the object) ^ force; (where ^ is the vector cross product);
}

It would take the position the force is applied on the object, and the direction of the force and add that to the netForce of the object.

[edited by - CombatWombat on May 28, 2004 9:55:29 PM]

Share this post


Link to post
Share on other sites
Cheers Mr Wombat.
Nice idea with the class object.
I''m currently looking into midpoint integration - similar to RK2 I think - don''t quite understand how to apply it yet - it''s the fact that you have to re-evaluate the fn at different times which throws me (used to my simple linear Euler code ).
Hmm think I better recap on my physics/integration/derivation knowledge - know of any good books/sources? Google is good but the info a bit disjointed.

Share this post


Link to post
Share on other sites
As far as I know RK2 is the so-called midpoint integration. I haven''t heard about ''the midpoint integration'', it''s just a "nickname"
No need for books, just look at a lot of sites about it. You will understand it. I also did.
And the main point is not the "at different time", but "with different initial state". Before evaluating the forces in step 2, you have to set the state accordingly to the formula.

Share this post


Link to post
Share on other sites
Quote:
Original post by CombatWombat
edit: alternately, you could make some kind of 'body' class that has a function like
AddForce(vector position, vector force)
{
netForce += force;
netTorque += (distance from position to the centerofmass of the object) ^ force; (where ^ is the vector cross product);
}


OK, so I've been away reading Calculus and mechanics books for a few weeks...
I have a question about Wombat's stuff above: where does the translational movement come from here?
I can see that a force would make the object rotate when applied in certain places, but if it was applied e.g. near the centre of mass there would be some translational movement as well as rotational.
Wombat's code seems to just add to the net force and then apply the force as torque as well - this seems wrong to me - and that only *some* of the force should go to translation unless applied directly at the centre of mass..?

[Edited by - Aph3x on June 20, 2004 6:08:27 PM]

Share this post


Link to post
Share on other sites