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
v = (0, 0, 10)
p = (50, 0, 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, the new v vector will be longer than the previous one (hypotenuse is always greater than two other sides in triangle).
so in my simulation the object always increase it's speed and instead of circular motion i have a spiral one.
where is an error ???????
thanx in advance