Im creating a an object that randomly moves in a natural way using noise like this (works as intended):
thisRabbit.x = _world.width * (noise(thisRabbit.t)); thisRabbit.y = _world.height * (noise(thisRabbit.t+5)); thisRabbit.t += 0.001;
The objects encounter a collision and their trajectory is manipulated, the movement path now changes to straight line (words as intended)
let vx = this.acquiredFood - this.x; let vy = this.acquiredFood - this.y; let f = (this.genes.speed + 10) / Math.sqrt(vx-vx+vy*vy); vx = vx * f; vy = vy * f; let newX = this.x + vx; let newY = this.y + vy;
The problem is after this movement , i want the object to start moving in a random direction again as it was initially. If i use the same function, the object jumps to the last location before the trajectory was modified.
So how do i get the object to move as before by giving a starting position