Publication date: 07/08/2024

Look At Function

The Look At function is an alternative way to set the camera view.

Look At( eyeX, eyeY, eyeZ, centerX, centerY, centerZ, upX, upY, upZ )

The Look At function puts the camera at the eye coordinates and points it toward the center coordinates. The up vector describes how the camera is rotated on its line of sight. The model is typically constructed at the origin. Therefore, a JMP scene should have either a Look At or a Translate message near its beginning to move the camera away from the origin.

First, clear the scene box of any messages from the previous frame.

scene << Clear;

Then use one of these projections:

scene << Perspective( 45, 2, 10 );
scene << Frustum( -.5, .5, -.5, .5, 1, 10 );
scene << Ortho( -2, 2, -2, 2, 1, 10 );
scene << Ortho2d( -2, 2, -2, 2 );

Note: If you use the ortho2d projection, you should not also set the camera position using either Translate or Look At.

Finally, use either Translate or Look At to set the camera position:

scene << Translate(0.0, 0.0, -4.5);
/* the camera faces down the negative Z axis.
	move it back so that 0,0,0 is in view. */
scene << Look At( /*eye*/ 3,3,3, /*center*/ 0,0,0, /*up*/ 1,0,0 );
/*this is much easier. */

Once the scene and camera position are set, add your model.

Want more information? Have questions? Get answers in the JMP User Community (community.jmp.com).