Tracking camera...

New Message Reply Date view Thread view Subject view Author view

Randy Stiles (stiles++at++aic.lockheed.com)
Wed, 11 May 94 13:59:12 PDT


   Date: Wed, 11 May 1994 12:36:22 -0700
   Mime-Version: 1.0
   Content-Type: text/plain; charset="us-ascii"
   From: jan++at++archimedes.chinalake.navy.mil (Jan A. Barglowski)

   Forgive me if this is really basic, but I want to implement a "tracking"
   camera. That is, a camera which always looks at a particular model. This
   model will be driven by data, so its position cannot be known before hand.

   The way I've been going about it is: take the position of the model and
   subtract the position of the camera. This gives a vector from the camera
   to the model. The problem now is getting this vector into a hpr form so
   that I can use the pfChanView function to set the viewing direction.

   Am I going about this wrong? I've looked in the myriad of Performer
   function calls to see if there is a conversion from vector to hpr, but
   can't find any. Is there a "Performer way" that does all this
   automatically?

Performer has a routine pfMakeRotOntoMat which
will give you a viewing matrix (or coords if you
use pfGetOrthoMatCoord) that will rotate from one
vector to another. The starting vector should be
0.0,1.0.0.0, and the end vector should be the
world coordinate xyz minus the current viewpoint
xyz, giving you a vector that points at the
desired object.

Of course to get world coordinates, for target
object, you have make sure all the transformation
matrices that are parents in the tree have been
evaluated (multiplied) against the objects DCS
matrix. You can premultiply this stuff yourself in
your own code using performer utilities. Obviously
performer evaluates these matrices to get world
coordinates in order to render stuff, but I haven't
come across the hook to get that info (maybe more
enlighted performer hackers can tell me where it
is... I hate re-evaluating something I know is
already out there, evaluated).

There may be a more direct way to do this point at
stuff, but I have tried it and it works reliably.
We routinely do this in our perfomer applications.
There is an infinite number of roll angles
possible, so you may wish to ignore the roll and
keep old roll values.

-Randy

# Randy Stiles (stiles++at++aic.lockheed.com)
# Office: 415.354.5256, Fax: 415.354.5235
# Lockheed R&DD, Orgn 9620 Bldg 254F
# 3251 Hanover St., Palo Alto, CA 94304-1191


New Message Reply Date view Thread view Subject view Author view

This archive was generated by hypermail 2.0b2 on Mon Aug 10 1998 - 17:50:16 PDT

This message has been cleansed for anti-spam protection. Replace '++at++' in any mail addresses with the '@' symbol.