Maxscript issue - distance


I have a little query:

I want to make a Maxscript that does the following:

Point001 is a fixed point.

The Pointt002 is a point, from which I can animate its position, it must have 2 controls

  1. look at, so that you always look at Point001.
  2. script so that it has a minimum distance between Point001 and Point002 = 0, or a maximum distance = 1000 (or whatever value I set), it cannot be further away. It is more or less like a constraints.

Box001, is any object, which I link to Point002


you could achieve the same effect as a surface constraint on point002 to a sphere centered on point001 (or position constrained to point001 or parented to) where the radius of the sphere gives you the fixed distance.


you could do this withour scripting.

my first idea would be to link (path constrain) Point 2 to a spline.

The spline is on a tanget from point 1, to the limit of the movement required.

This spline is linked to (or pivot aligned) to Point 1, so you can roate the spline to control point 2’s position (local X and Y).

You then define the in and out limits by the length of the spline, and move point 2 using the % along path to control this local Z / distance from point 1.