Jump to content
  • Advertisement

Archived

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

Fusi0n

mass, forces and angular acceleration

This topic is 5526 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

hi all, im in the process of getting down some sort of physics framework at the moment but have kinda got stuck at the first hurdle im trying to define a mass class that will hopefully be the basis of all my objects. what im trying todo is figure out how a mass will react to a force applied upon it. by react i mean what accelerations will result from a force applied to a point relative to the center of the mass. maybe if i define my mass class i can clarify things a bit:
//-----------------------------------------------------------------------------
CMass : public CObject3D{
	public:
		//-------------------------------------
		float f_mass;
		CVector3D v_center_of_mass;
		CVector3D v_location;
		CVector3D v_velocity;
		CVector3D v_acceleration;
		CVector3D v_angular_location; // will be quat
		CVector3D v_angular_velocity;
		CVector3D v_angular_acceleration;
		//-------------------------------------
		CMass();
		CMass(float pf_mass, CVector3D *pv_center_of_mass);
		~CMass();
		//-------------------------------------
		void ApplyForce(CVector3D *pv_force, CVector3D *pv_application_point);
		//-------------------------------------
		void Update(float pf_time);
		void Render();
		//-------------------------------------
	};
//-----------------------------------------------------------------------------
 
does that look ok? thats how im defining it so far. the problem i have run into is with implementing the ApplyForce function. as you can see it takes in two vectors, one is the force (in newtons) being applied, and the other is the point relative to the center of mass that the force is being applied at. as i understand it, if we apply a force at the center of mass, this will result in acceleration of the mass in the direction of the force, depending on the size of the mass (a=f/m), with no resulting angular acceleration. also, if the application point shares an axis with the center of mass (ie one of its components is 0) and the direction of the force being applied at that point is the same as the direction of the axis, then this should result in acceleration along that axis, also with no resulting angular acceleration. but what if the application point is not the center of mass and doesnt share an axis with the center of mass, or the force does not act in the same direction as the axis on which the application force lies? in this case the resulting acceleration must depend on the vector (direction and magnitude) of the application point to the center of mass as well as the vector (direction and magnitude) of the force. not only that but this must also produce some angular acceleration depending on the same factors. as the force cannot disappear, the force resulting in acceleration of the mass and the force resulting in the angular acceleration of the mass must sum to equal the force being applied at the application point. at this point i ask: is what ive said so far correct? if not, what is the correct way this works? my question is this: how do i figure out how much of the force results in angular acceleration and normal acceleration using the force vector and the application point? someone advised me to look into cross/dot products, but i fail to understand how to apply them to this problem :s please set me straight on my thoughts and thankyou for taking the time read this rather lengthly post "We are what we repeatedly do. Excellence, then, is not an act, but a habit." - Aristotle

Share this post


Link to post
Share on other sites
Advertisement
Guest Anonymous Poster
3d rotation requires a good deal of math. This might help:
http://www.d6.com/users/checker/dynamics.htm
It has lots of good information on computer simulation of physics.

You won''t get very far in making your own physics simulation unless you understand all the math behind it. So, if it is new to you, then take your time. It is lots of fun once it is working right, although some bugs are fun to see while developing it.

Share this post


Link to post
Share on other sites
wow, thanks for the link, a great deal of useful information there

however... it has forced me to question how forces act on bodies in the real world. the equations presented in the pdf''s on that site resolve the angular and linear accelerations independant of one another, is this the way it works in the real world? i was under the impression that the applied force is divided between the angular and linear accelerations.

the links to the demos on the site are very nice, i see euler integration is used with a fixed time step, maybe using verlett would be a ''better'' solution but i digress. the collision repsonse in the demos seems a little strange to me, the overall direction of motion doesnt appear to be affected by the point of contact or the angular velocity (i could be wrong, im severly sleep deprived).

so going back to my question above, shouldnt the point of application of the contact response force affect the direction of motion as well as the angular velocity? for example (look at the 3d demo on that page), if you drop a rotating cube to the ground and one of its corners hits first, would this not affect the direction of motion? in the 3d demo it appears it does not (if the cubes/rectangles have no x/y velocity components (taking z to be up/down) but do have angular velocities, they just seem to bounce along the z axis, with their angular velocity changing but with no change in the x/y components of their motion).

another example:

take a stationary cube with its center of mass to be in the center of the cube, and apply a constant force to one edge; you would expect the cube to not only rotate about the center of mass but also move, not in the direction of the force, but in an arc like motion. if the applied force is not a constant one but instead an impulse force, the resulting linear motion would not be in the same direction of the impulse force surely? or am i way off?

dont get me wrong, those pdf''s are great and have cleared up a lot of questions, but im lacking a certain clarity when it comes to how the angular velocity and linear velocity are related in terms of a contact force.

any feedback is very welcome thanks

and now i must sleep

"We are what we repeatedly do. Excellence, then, is not an act, but a habit." - Aristotle

Share this post


Link to post
Share on other sites
Yes the interaction between angular and ''normal'' forces and accelerations is a little weird. You can test it yourself that if you hit something hard at a weird angle, it both rotates and translates. I think the key to figuring it out is the same as in a normal collision though - you must conserve momentum and energy, both angular and translational. Unfortunately in 3D you have a 3x3 moment of inertia tensor and all that fun stuff. This is bringing back horrible memories of mechanics class!

Share this post


Link to post
Share on other sites
right, having slept on this (i actually wake up with answers sometimes) i have deducted that the demos on that page do not apply the response force to the point of contact, but to the center of mass, in effect just flipping the z component of the force affecting the object, hence no movement in any of the other axis.

ill take a look at the source code now and see if i can understand (im not very good and reading code ;s)

"We are what we repeatedly do. Excellence, then, is not an act, but a habit." - Aristotle

Share this post


Link to post
Share on other sites
ok then, i didnt end up looking at the code, instead i got out my pencil and paper and decided to use my own brain power to figure it out, and this is what ive come up with so far:

we have a point P which is relative to the center of mass CM. a force F is applied at P. to figure out how much of this force results in angular and linear acceleration we must define F in terms of the vector P->CM and the vector perpendicular to P->CM, which we will call P->CM_|_. the amount of force acting in the direction of P->CM produces our linear acceleration and the amount of force in the direction of P->CM_|_ results in angular acceleration. heres an ascii diagram to help explain:


_CM
\ ./|
\ ./
\ ./ P->CM
\ ./
\/\./
------>\/P
F \
\
\ P->CM_|_
\
\|
¯

(sorry, im not very good with ascii art - [link]http://www.cloudfusion.com/math.jpg[/link] - the top left doodle depicts the same diagram and is a bit more readable).

so, now the problem is how do we go about defining F, which is in world space co-ordinates, in terms of P->CM and P->CM_|_. im sure this will require some sort of sin/cos stuff, not exactly sure at the moment, im still trying to figure out if what i suggested above is indeed correct.

feedback is welcome thanks

"We are what we repeatedly do. Excellence, then, is not an act, but a habit." - Aristotle

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
quote:
Original post by Fusi0n
.... i have deducted that the demos on that page do not apply the response force to the point of contact, but to the center of mass...


Actually, that is how it is done. It seems strange at first, but consider an object that cannot rotate. It will just accelerate in the direction of the force regardless of where it is applied.


If you look at http://www-2.cs.cmu.edu/afs/cs/user/baraff/www/pbm/rigid1.pdf
on page 28, at "5.5 Force vs. Torque Puzzle"
There is a very good example of how it works, and why.


When you have time, Read all of these, too.
http://www-2.cs.cmu.edu/afs/cs/user/baraff/www/pbm/pbm.html

Share this post


Link to post
Share on other sites
now im really confused, so is what i just posted completely wrong :? thanks for links, reading now

"We are what we repeatedly do. Excellence, then, is not an act, but a habit." - Aristotle

Share this post


Link to post
Share on other sites
I couldn''t quite follow your post ... and am not an expect on this at all ... but I do have 2 things to say which may help your mental picture a little.

1. You can fairly well ignore the thoughts about "what if the body cannot rotate, then it just does strait translation" ... this is 100% true, but the ONLY reason a body cannot rotate is if it is either PART of a larger ridgid body, or is impacting another body ... so for you basic minimal simulation of independent reactions of bodies to forces, this will not matter at all ... all of your bodies (masses) are assumed to be able to freely translate and rotate, as if alone in space (right?).

2. Contrary to some people''s belief and experience, it is impossible to cause a free body to rotate by applying a single force on it ... without also causing some amount of translation.

The equations you end up with should probably end up computing the angular and linear (translation) adjustments seperately, with no regaurd for eachother ... because you are speaking of INSTENTANEOUS acceleration here ... a single instance of force transfer ... and of course the laws of conservation of energy says the totals MUST equal the original force total ... but that is a consequence of using correct math to computer each set of numbers, NOT because of specially appied interaction between the two.

Of couse to simulate objects attached to other objects and such ... all sorts of crazy interactions occur ... but that''s far more adanced ..

P.S. What are you planning to do with the acceleration variables? Are you going to act like each force which you apply is acting on the object over a nominal period of time ... and from that determine an average acceleration for purposes of G forces and such?

Share this post


Link to post
Share on other sites
thanks right, i guess i have todo a bit of clarifying

1. yea i agree, having an immovable (linear or angular) mass just doesnt make sense, even if its in a system of other objects, it still has the capability of movement, its just the forces being applied to it by the other objects its connected to prohibit this.

at the moment im trying to keep it as simple as possible, just an object in space with the ability of free motion (linear and angular) ignoring all constraints, i just want to model the reaction of the mass when a force is exerted on it.

2. im not sure myself on this, what if the force is applied in a direction that is perfectly perpendicular to the vector from the center of mass to the application point? as its perpendicular would this cause no translation? of course im going on the assumption i made in my reply earlier that the translation of te mass depends on how much of the force being aplied acts in the direction of the vector from the application point to the center of mass.

quote:

The equations you end up with should probably end up computing the angular and linear (translation) adjustments seperately


yes i think they would too, as, again going on my previous assumption the direction of the force that results in translation is/shoud/would be perpendicular the direction of the force that would cause angular acceleration.

yes i am thinking of instantaneous acceleration, for every frame a force will be applied to a point which will cause an acceleration.

well, what i intend todo with the acceleration at the end of this is simply apply it to the objects velocity. i would like all the forces acting on the object at any one time to be summed up internally by the object and have an overall linear and angular acceleration be produced every frame.

thanks for your input, you have made things much more clear and it appears im kinda on the right track i still need to understand a lot more

"We are what we repeatedly do. Excellence, then, is not an act, but a habit." - Aristotle

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!