News Feed

Bureau V

News Feed

Means of Production

Tuesday
Feb082005

« Calculate Distance »

A short MEL script that calculates distance between two objects in space.


// cALCULATE DISTANCE
global proc float calcDistance(string $one, string $two){

        float $currentpos[] = `xform -ws -q -t ($one)`;
        $v1 = <<$currentpos[0],$currentpos[1],$currentpos[2]>>;
        float $poscheck[] = `xform -ws -q -t $two`;
        $v2 = <<$poscheck[0],$poscheck[1],$poscheck[2]>>;
        
        return abs(mag($v1 - $v2));
                
}