Сan any body explain me the script for the tangential motion,so that when i cut the rope circle should move tangentially:

enter image description here


First, let's define a few terms to make this simpler. Rope Vector: This is the vector from the ball's position to the anchor point (i.e. the rope). I am assuming it is not normalized. Ball Position: The center position of the ball, and the point from which the Rope Vector originates. Anchor Position: The other end of the rope, the point you are swinging around. Up Vector: A vector that points in the direction of "up". If you're in 3D, and the balls are moving along X and Y, your Up Vector will be {0,0,1} (a Z component of 1).

Since you have the Rope Vector, you just need to generate the vector that is perpendicular to your Rope Vector. The most straightforward way would be to figure out what direction you consider "up", and then take a cross-product of your rope vector and your up vector. You're not clear whether you are in 2D or 3D, so I am assuming 3D, but the math works the same either way (although you can remove components and make it simpler for the 2D case, its not important). The cross product will give you a vector perpendicular to the 2 vectors passed in. The order of the terms in the cross product will determine which direction the output points. You can now take your output vector and normalize it (divide each term of the vector by the vector's total length). This vector can be scaled by the current speed of the ball, and added to the Ball Position, which would give you a velocity vector in the perpendicular direction.

I've glossed over a few points, but this is a general solution to your problem. I can certainly elaborate if you specific questions. If you are doing all of this in 2D, you can convert them to 3D (just add a Z coordinate of 0 to each term), have an up vector of {0,0,1} and do the math. You'll see a bunch of terms cancel out because of the 0's, but you'll end up with a result that doesn't have a Z component, only X and Y.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.