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

In summary: Point {public: Point(const std::vector<float>& v); ~Point();std::vector<float>& v;};In summary, the object's current position and velocity is calculated every step, and the new force is also calculated. If you want the object to move in a circle, you need to make sure that the force has a specific relation to the initial velocity.
  • #1
Zav
1
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
  • #2
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.
 
  • #3
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:
  • #4
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;
 

What is 3D motion simulation?

3D motion simulation is a computer-generated technique that allows for the visualization and analysis of movement and interactions between objects in a three-dimensional space.

How does 3D motion simulation work?

3D motion simulation involves using mathematical algorithms and computer graphics to simulate the movement and interactions of objects in a virtual environment. This is achieved by inputting data such as physics laws, object properties, and user commands into the simulation software.

What are the benefits of using 3D motion simulation?

3D motion simulation offers a variety of benefits such as the ability to test and optimize designs, reduce the risk of physical prototypes, and visualize complex movements and interactions. It also allows for the analysis of data such as forces, velocities, and accelerations in a dynamic environment.

What industries use 3D motion simulation?

3D motion simulation is used in a wide range of industries, including automotive, aerospace, robotics, biomechanics, and entertainment. It is also used in research and development to study and improve human movement and performance.

What are the limitations of 3D motion simulation?

Although 3D motion simulation offers many benefits, it also has some limitations. These include the cost of software and hardware, the need for accurate input data, and the potential for errors or inaccuracies in the simulation. It also cannot fully replicate real-world conditions and may not account for unforeseen factors or variables.

Similar threads

Replies
43
Views
2K
Replies
3
Views
894
Replies
4
Views
2K
  • Classical Physics
Replies
7
Views
827
Replies
1
Views
2K
  • Introductory Physics Homework Help
Replies
15
Views
1K
  • Introductory Physics Homework Help
Replies
11
Views
1K
Replies
1
Views
4K
Replies
14
Views
1K
Back
Top