Rotate objects toward magnet point

Posted in: In Action!- Apr 05, 2013 No Comments

In this video I have tried to show how you can use Para to manage a bit complex max-script code which can keep the objects pointing toward a point inside the scene. Although for MAX users this is quite easy with “Look At” controller which does the same job. But here I’m trying to come up with an example of setting up a complex logic that deals with many controllers of Para 3d.
In order to rotate objects toward a magnet point you need to first find the angle of the rotation. If objects are initially located aligned with Y axis you need to find the angle between Y axis and the direction vector. Direction vector will be direction of a line that connects the objects to the magnet point. To find the vector you need to find the position of the object (A) and position of magnet point (B) . In vector calculus A-B would be the direction vector from A to B. You will find in video that this is not always working, when the objects is on the left side of magnet point you need to flip it. To find which objects are on the left side you use a “Condition controller” in connection with “test value” controller. At the end of video you can see how objects rotates as they get closer to the magnet point, it has been achieved by multiplying the rotation amount by magnet controller output (a value between 0 and 1)

No Responses to “Rotate objects toward magnet point”

Leave a Reply

You must be logged in to post a comment.