- Home /
Force perpendicular to motion of Object isn't working.
I am simulating the force on a moving charge due to a uniform magnetic field. The force given by the cross product of the magnetic field (B) and the velocity(v) of the charge which should result in a force perpendicular to the direction of motion. If the B= (0,0,1) and initial v=(1,0,0) then the motion of the charge should be CIRCULAR in the x-y plane.
I use AddForce inside FixedUpdate and I get motion that is spiraling outwards instead of being circular. This suggests that the force I am calculating is not exactly perpendicular to the motion, causing it to speed up as well as turn in a circle.
function FixedUpdate () {
this.rigidbody.AddForce(Vector3.Cross(this.rigidbody.velocity, bField));
}
Any ideas about the timing? I think the force is not being applied directly perpendicular to the motion but not sure
PS: I'm a physics prof so my understanding of the physics outweighs my coding skills here.