#368132
Hi,
in this script :
http://support.nextlimit.com/download/a ... naround.py

there's a line
Code: Select all
camera.setStep(0,newpos,target,up,focalLength,fStop,0);
'target' and 'up' being vectors.

How do I access those vectors best with a standard Maya camera (no target null) ? ( Just searching the values, the rest is clear )
The difficulty I have is that those values are not accessible directly, so I'd have to calculate them via some vector math. Is that the correct / easiest way ?

How was that solved in the maxwell plugin ?

Thanks for any input !

Matt
#368137
You can obtain the up and forward vectors directly from the world matrix of the camera. To compute the target, normalize the forward vector, multiply it by the center of interest distance (which is an attribute on the camera) and subtract from the position, like in the following MEL snippet:
Code: Select all
float $wm[] = `getAttr camera1.wm`;
float $targetDist = `getAttr camera1.centerOfInterest`;

float $pos[]     = { $wm[12], $wm[13], $wm[14] };
float $up[]      = { $wm[ 4], $wm[ 5], $wm[ 6] };
float $forward[] = { $wm[ 8], $wm[ 9], $wm[10] };

normalize($forward);
float $target[] = { $pos[0] - $forward[0]*$targetDist, $pos[1] - $forward[1]*$targetDist, $pos[2] - $forward[2]*$targetDist };

print ("Position: (" + $pos[0] + ", " + $pos[1] + ", " + $pos[2] + ")\n");
print ("Up:       (" + $up[0] + ", " + $up[1] + ", " + $up[2] + ")\n");
print ("Target:   (" + $target[0] + ", " + $target[1] + ", " + $target[2] + ")\n");
The Maxwell plug-in uses the MFnCamera class, which provides methods for retrieving this information, but internally they just do what I've shown above.
the render does not start

I tried hiding many of the objects in the scene wh[…]

Sketchup 2024 Released

I would like to add my voice to this annual reques[…]