
#1
Jul2909, 08:29 PM

P: 2

Hi guys.
Sorry if this seems like an extremely simple question, but Im never took physics. Im a programmer attempting to work with a physics system in an application. What Im trying to do is create a physical object in the system that represents the users mouse (the object being a cylinder projecting down from the camera into the scene). I need to move the projected object with the mouse, and because of the system, this has to be done with a force, so that I can add gravity on top of it. I was previously setting the velocity of the object, since I know the old and new mouse position (at each movement) and the time between these moves. This however doesn't allow me to add gravity as a force. Unfortunately due to my appaling understanding of physics, Im finding this quite difficult. I know the distance travelled, the time taken. I've tried extrapolating the acceleration from suvat equations, but to no avail. Apologies for posting what is most likely a very simple question, but this is a small part of a much larger project, and was hoping somebody could point me quickly in the right direction. Cheers in advance, cal. 



#2
Jul2909, 08:50 PM

P: 1,345

Hello sofcal!
If you're talking about moving this cylinder horizontally along the ground then the force required to move the cylinder must over come the force of friction: [tex] Moving force > \mu_{kinetic} mg[/tex] Where mu is the kinetic friction coefficient (a constant determined by the two surfaces that meet: in your case the ground and the bottom of the cylinder). m is the mass of the cylinder and g is the acceleration due to gravity ~9.81 on Earth. If you're talking about moving the cylinder straight up into the air it must over come the force of gravity: [tex] force upward > mg[/tex] I'm not particularly sure if this is what you were looking for but perhaps it helps... Oh I should also remark that a force accelerates an object so you will have to take that into consideration as well. In case you don't know how the two are related: [tex]F = \frac{d(mv)}{dt} = m \frac{dv}{dt} = ma[/tex] 



#3
Jul2909, 09:10 PM

P: 2

Hi feldoh, thanks for the quick reply.
Fortunately with this being a simulation, I can negate friction all together (im currently just hovering the item above the ground, with no gravity acting on it). I think I've just realised another component to my problem. While I do need to apply a force that will move the object from one point to another, I also need to apply a counter force to the object to stop it when the mouse isn't moving (assuming the object has gotten to the right position). Correct me here then when i go completely off the rails :) F=ma Where F is the resultant force, m is mass and a is acceleration. If I know the distance travelled, and the time taken I can get the average velocity by v = d / t where v is velocity, d is distance and t is time. s = vt  (at^2)/2, so a = (2*(vts)) / t^2 F then would be F=m * ((2*(vts)) / t^2) That seem right? I'd then apply a counter force to stop the object when the cursor is stood still. Would that just be minus the current force? 



#4
Jul2909, 09:26 PM

P: 1,345

Force needed to move an object from one point to another.
Yes you are correct but there are a few things I should warn you about:
1.) s = vt  (at^2)/2 assumes there is a constant acceleration and by extension a constant force 2.) Be careful about your sign! Acceleration is a vector so make sure in s = vt  (at^2)/2 a has the right sign (positive a for this particular equation would be slowing down, while negative a would be speeding up) 3.) A force changes the acceleration so if you want to make something stop faster apply a negative force for a longer time, or a larger force for a short period of time. Another helpful equation might be: [tex]Impulse = F \Delta t = m \Delta v[/tex] So let's run through this: If you have an object just floating in the air (no friction) and you want to move it horizontally you apply a (constant) force which will (constantly) accelerate an object. When that force is released the object will continue to move with a certain constant velocity (because there is no longer acceleration). To stop the object you must apply a (negative) force so the object will deaccelerate until the objects velocity is 0 (v = 0 implies no more movement obviously) Make sense? 



#5
Jul2909, 09:56 PM

PF Gold
P: 864

Hi sofcal. You seem to be having several problems. First, you need to be able to calculate the position and velocity with a given force. The equations you are using give an exact solution for a constant acceleration. The moment the force changes, they stop working. They are not the most convenient form to use in a computer.
There are many algorithms people use in computers to do accurate simulations of physical systems (look up the verlet alogorithm if you are interested) but that is overkill here, I think. I think you just want to make the motions seem natural to the user (If I am not mistaken) and in this case, Euler's method is very straightfoward and will give good enough results. Here is how you use it: At some time, t, the object has position x(t), velocity v(t), and the force on it is F(t). You want these variables at the next time step, [tex] t + \Delta t[/tex]. Since acceleration is the rate at which velocity changes, a good approximation for small time steps is: [tex]v(t+\Delta t) = v(t) + a(t)*\Delta t[/tex] [tex] F = ma[/tex], so [tex] a(t) = \frac{F(t)}{m}[/tex] so the velocity at the next time is [tex]v(t+\Delta t) = v(t) + \frac{F(t)*\Delta t}{m}[/tex] For the position at the next time you can use [tex]x(t+\Delta t) = x(t) + v(t)*\Delta t[/tex] or, alternatively [tex]x(t+\Delta t) = x(t) + \frac{v(t)+ v(t+\Delta t)}{2}*\Delta t[/tex] These two should be almost equal for small [tex]\Delta t[/tex] You just apply this iteratively, using the results of one step to put into the next. 



#6
Jul2909, 10:10 PM

PF Gold
P: 864

The next problem you will run into is what to use for the force. If you simply apply a constant force on the object in the direction of the mouse, or if you use a force proportional to the distance between the two, you will have "ringing"
This means the object will overshoot the mouse, keep going until it slows down completely and comes back, then overshoots again, and so on forever. You need to add "damping". This means that part of the force just opposes the velocity and tends to bring the object to a rest. I would suggest a force that looks like this: [tex] F(t) = k*(x(t)  x_{mouse}(t))  c*v(t)[/tex] The undefined symbols are: [tex]x_{mouse}(t) = [/tex] position of the mouse at time t k = "Spring" constant, force of attraction between object and mouse c = "Viscous damping coefficient", force that slows the object down You can experiment with different values of 'k' and 'c'. Different values will give different behavior. See http://en.wikipedia.org/wiki/Damping 


Register to reply 
Related Discussions  
How do wheels decrease the amount of energy needed to move an object?  Classical Physics  22  
Using a Fan to move an object  General Physics  17  
Force needed to move a box.  Introductory Physics Homework  1  
need some help, force to move an object...  Introductory Physics Homework  7  
Force needed to keep object from accelerating problem  Introductory Physics Homework  4 