Friction and energy loss in computer please read

Started by
5 comments, last by DirectXXX 20 years, 6 months ago
*** FrictoinForce = -VEL * constant Every where i read this about frictional force. When i implemented it, the moving object slows down very smoothly, the velocity becomes very small but never ever zero. But in real world the velocity does not slow down like this it become very small and at a certain small speed it instantly becomes zero. *** VelAfterCollision = -Vel * constant In REAL world when an objects falls and hit the ground. It bounces for a time but at a certain energy level, it stops bouncing. And becomes equilibrium. But in computer sim, using above equation the objects bounces all the time even though kinetic energy goes very small that it looks the ball is not bouncing but it is always bouncing. *** Also in real world to move an object you must apply a force higher than a certain amount to move it. other wise it does not move even if you are applying a force. But in computer sim using above equation the object starts move no matter how low the applying force is and how high friction factor is. --------------------------------------------- How can i solve this problem for comuter
3D Side-Scroller game demo Project-X2 "playable"Lashkar: A 3D Game & Simulation Project demo @ lashkar.berlios.de
Advertisement
old games used
Vnew = Vold * constant
(with 0 <= constant <= 1)

this is just a nice shortcut for friction, and it isn''t physically correct. This doesn''t put in the time in, and on different processor speeds your objects stop in different times.

Correct model is:
FrictionForce = A * (ForceToGroundNormal)

Speak, if your object slides over the ground (Norm-Vector directed upwards), ForceToGroundNormal = 9.81 * 1 * weight
Speed reduces by FrictionForce / weight

so finally:
Vnew = Vold - 9.81 * A * deltaTime

(A is the friction coefficient, which depends on both materials. for example Iron//Ice = 0.015, wood//wood = 0.3)

This asumes gravity is = 9.81m/s², and you have no additional force in ground nomal (for example a rocket boosting you up or down somehow)

Finally just watch out your Friction will not revert velocity in the other direction. In that case you have to set the velocity to 0.
-----The scheduled downtime is omitted cause of technical problems.
Hello DirectXXX.

I''ll start with stuff I kind of partially know, there are two types of collision elastic and inelastic. I cant remember which is which, but that don''t matter, you will know what I mean.

in one (i think elastic) all of the energy of the collision is preserved, so that if my bouncy ball hits the wall at 100 km/s it will bounce back at 100 km/s.

then in the other collision (lets call it inelastic) some of the energy of the collision is lost. Either to permanent deformation if the objects involved, such as two cars mangling into eachother, or through the emission of heat and sound.

So for your continuous bouncing problem, for each object define some sort of energy diffusion factor for use in collisions. Use it similarly to the friction forces, so that it reduces proporitonally for each bounce.

However this will still suffer from your other problem, the effect will continuosly diminish but not stop.

Your solution to this should solve all of your other problems as well, and I think you hinted at it with your example of pushing against some object, but not quite providing enough force to start that object moving. You need less force to keep an object moving than you do to start it moving, which suggests that objects at rest or at relatively low velocities suffer from a proportionally greater amount of friction. How you want to implement this effect is up to you, but keep in mind that surfaces can vary in this regard. I think there is also a minimum cost in energy to be paid in addition to the proportional to velocity cost.


quote:Original post by Gleno
I''ll start with stuff I kind of partially know, there are two types of collision elastic and inelastic.

totally elastic is a perfect collision, where all movement energy is converted back to movement energy.
Inelastic is, like you said, where all movement force is used to deform the objects. Simulating reality you have to use a mix of both.

quote:Original post by Gleno
Your solution to this should solve all of your other problems as well, and I think you hinted at it with your example of pushing against some object, but not quite providing enough force to start that object moving. You need less force to keep an object moving than you do to start it moving, which suggests that objects at rest or at relatively low velocities suffer from a proportionally greater amount of friction. How you want to implement this effect is up to you, but keep in mind that surfaces can vary in this regard. I think there is also a minimum cost in energy to be paid in addition to the proportional to velocity cost.

It is called "sticky friction" and "sliding friction" (don''t know if these are the propper translations).
If you have a static object, to get it in movement you have to bring up a force to overcome the sticky friction. once the object moves, you only have to fight the sliding friction to keep it in movement.
You can imagine two brushes lying on each other, toothed. Once the objects slide, they don''t stick that much together any more and slide with less force.
-----The scheduled downtime is omitted cause of technical problems.
quote:Original post by OmniBrain
It is called "sticky friction" and "sliding friction" (don''t know if these are the propper translations).


Static and dynamic(al) friction, respectively.

quote:
If you have a static object, to get it in movement you have to bring up a force to overcome the sticky friction. once the object moves, you only have to fight the sliding friction to keep it in movement.


Read OmniBrain''s post, except realize that if two surfaces are in contact and not moving past eachother, there is a certain coefficient of static friction. When those same two surfaces are sliding past eachother, the coefficient of dynamical friction is used. Generally, the static coefficient is greater than the dynamic one.

The force produced by surface friction is generally modelled as independent of relative velocity of the surfaces. It acts in the direction opposite to the direction of relative motion of each surface, thus causing a net acceleration that slows down the motion, unless there is sufficient external force to sustain it.

This results in a linear loss of velocity, not exponential as you observed with your other friction equation (see below). When the velocity reaches 0, there is no relative velocity, so there is no longer any friction to oppose the motion. The system returns to a static state. This is different from the exponential velocity decay, which never reaches equilibrium.

The F = - v * constant is (I belive) more typically used for objects travelling through fluids (gas or liquid). F = - constant * v ^ 2 can also be used, depending on the physics of the situation (do some research). This is a gross simplification however, and the "constant" is very much dependent on geometry and the materials involved.
quote:Original post by DirectXXX

***
FrictoinForce = -VEL * constant
Every where i read this about frictional force.

Dunno where you read this, but it''s wrong wrong wrong. It''s not even what they teach you in Physics 101.

Here''s what they DO teach you in Physics 101:

Acceleration = Force / Mass
Force of Friction = Mu * Normal Force
Normal Force = -Gravitational Force
Gravitational Force = Mass * Acceleration Due To Gravity (g)

Plugging it all in, we find:
Acceleration = Mu * g

Easy, huh? Now: what''s Mu? It''s the coefficient of friction, which exists between two smooth surfaces. The higher the coefficient of friction, the more the surfaces "stick" together. The oversimplified, but very useful, way to think about it, is that there are TWO Mu''s: Mu-Kinetic, which applies when the object is moving, and Mu-Static, which applies when it is not.

To convert this into terms useful for game programming:

Vel = max((Vel - SomeConstant), 0)

This makes sure that friction doesn''t make the object move backwards. You don''t have to worry about Mu-Static unless the object starts to move again; in that case, all you need to remember is that you need to overcome the force of static friction in order for the object to move at all.

Now, moving to bouncing: Your equation is fine. But to make things simpler, you may want to do this:

VelAfterCollision = -Vel * constant
if(Vel < otherConstant) Vel = 0

How appropriate. You fight like a cow.
quote:Original post by Geoff the Medio
The F = - v * constant is (I belive) more typically used for objects travelling through fluids (gas or liquid). F = - constant * v ^ 2 can also be used, depending on the physics of the situation (do some research). This is a gross simplification however, and the "constant" is very much dependent on geometry and the materials involved.


Force proportional to velocity is usually drag from a fluid medium, as stated, and comes from the fluid needing to be pushed out of the way (superfluids have no viscosity so no drag). Friction is usually modelled as independent of velocity (except for the static/dynamic step) and comes from two surfaces sliding past each other.

It''s been a long time since I actually did the physics, but I think high-velocity turbulent drag is one of about two or three formulae that actually involve a fourth power in physics. I could be wrong on this one.

Friction will cause linear decay of velocity, while drag will cause logarithmic decay, so an object moving in a fluid should never stop. Except, of course, these are only approximations, and leave out all sorts of things - for an object in fluid, the details include various wave effects and brownian motion - for example, pushing something hard enough through a viscous fluid will cause it to come to a stop rapidly and actually recoil slightly.

Ultimately, it''s important to remember that the universe processes in massive parallel and has a resolution of between 60 and 70 orders of magnitude and a framerate which isn''t expressible in SI prefixes (last I heard they only go up to 10^24 - we need 10^43) so modelling the fine details on your system is probably not feasible. The level of approximation you settle for is entirely up to you (and your hardware).

This topic is closed to new replies.

Advertisement