How Can I Fix the Error in My 3D Motion Simulation?

AI Thread Summary
The simulation error arises from the force vector not being correctly aligned for circular motion, leading to an increase in speed instead of maintaining a constant velocity. For true circular motion, the centripetal force must always point toward the center and maintain a specific relationship with the object's velocity. The calculations should separate forces in the x and z directions, ensuring that the force components are balanced to prevent acceleration. Implementing a vector class can simplify calculations and improve code readability. Properly adjusting the force calculations will correct the spiral motion to achieve the desired circular path.
Zav
Messages
1
Reaction score
0
hi,
i try to build a simulation of an object in 3d space.
the object is point object with properties like this:

p : current position of an object.
v : current velocity of an object.
f : current force applied on an object.
m : object's mass (1 kg)
dt : time elapsed since previous step

start condition:
v = (0, 0, 10)
p = (0, 0, 0)
dt = 0;

at every simulation step (about 0.1 sec) the following calculations are made:
dt = GetTimeSinceLastStep()
f = CalculateForce()
v = v + (f / m) * dt
p = p + v * dt

the function CalculateForce calculates the current force at every step.
let's assume that this function always return force in zx plane, perpendicular to the current velocity toward (0, 0, 0).

in such case, object suppose to perform circular motion with constant speed about the origin in zx plane. but here is my problem [(f/m) * dt] vector (that added to current velocity) will always have some length. so after addition it to v (according to Pythagoras law) the new v vector will be longer than the previous one.

so in my simulation the object always increase it's speed and instead of cirlular motion a have a spiral one.

where is an error ??

thanx in advance :)
the new
 
Physics news on Phys.org
Force is a vector. For circular motion, you need to have the force always pointing towards the center of the circle of motion, the centripetal force. This force has to have a specific relation to your initial velocity for you to actually have the object move in a circle. So you should expect to get a force of constant magnitude.
 
If you are working in a two dimensional plane, you should work with two forces, one in z direction and one in x direction. Your program should more or less look like this

f_x = CalculateForceX()
f_z = CalculateForceZ()
v_x = v_x + (f_x / m) * dt
v_z = v_z + (f_z / m) * dt
p_x = p_x + v_x* dt
p_z = p_z + v_z* dt

the relations for the force would be something equivalent to f_x = -F*cos(phi) and f_z = -F*sin(phi). Phi is the angle between the x-axis and the current place of your mass in counterclockwise direction. F is the centrifugal force, directed to the center, this should counter the centripetal force, this is m*V^2/r if I remember correctly, with V it's total speed and r the distance to the center.
 
Last edited:
If you're using an OOP, I suggest making a vector class. If you're using C++ specifically, you can overload operators, so that instead of writing

v_x = v_x + (f_x / m) * dt
v_y = v_y + (f_y / m) * dt
v_z = v_z + (f_z / m) * dt

you just write

v = v + f/m * dt;
 
The rope is tied into the person (the load of 200 pounds) and the rope goes up from the person to a fixed pulley and back down to his hands. He hauls the rope to suspend himself in the air. What is the mechanical advantage of the system? The person will indeed only have to lift half of his body weight (roughly 100 pounds) because he now lessened the load by that same amount. This APPEARS to be a 2:1 because he can hold himself with half the force, but my question is: is that mechanical...
Some physics textbook writer told me that Newton's first law applies only on bodies that feel no interactions at all. He said that if a body is on rest or moves in constant velocity, there is no external force acting on it. But I have heard another form of the law that says the net force acting on a body must be zero. This means there is interactions involved after all. So which one is correct?
Let there be a person in a not yet optimally designed sled at h meters in height. Let this sled free fall but user can steer by tilting their body weight in the sled or by optimal sled shape design point it in some horizontal direction where it is wanted to go - in any horizontal direction but once picked fixed. How to calculate horizontal distance d achievable as function of height h. Thus what is f(h) = d. Put another way, imagine a helicopter rises to a height h, but then shuts off all...
Back
Top