distance measurement [3DS Max Script]


distanceFromCamer
This is a simple script for 3DS Max that measure distance between camera and selected object.
It came really hand when You work with the, for example, DOF or some XSI ink shader that uses distance values to perform some actions. Normally taper is used for this task but it’s an hassle to set it up. I wanted something really fast.

The distance is given in the currently used unit. Measurement is calculated between object pivot and camera (not camera target) pivot.

Script itself:

Macroscript distanceFromCamer
Category: "MyUtils"
Tooltip: "Mesure distance from the object to camera"

(
    cam = getActiveCamera()
   
    if (cam == undefined)
    then (
            displayTempPrompt  ( "Select/Create camera" ) 15000
        ) else (
       
            if( $ != undefined )       
            then (             
                dist = (distance cam.position $.position) as String
                displayTempPrompt  ( "Distance from camera " + dist) 15000
            )else(             
                displayTempPrompt  ( "Select object" ) 15000
                )
        )      
)

Some pictures presenting script in action:

Link:
cameraDistance

License:
Freeware

, , , ,

Comments are closed.