Scott McMillan (scott++at++ht.com)
Wed, 21 May 1997 13:39:17 -0400 (EDT)
I think the following code is a start...it probably does weird things with
the roll though. Use the returned matrix to set the channel view matrix.
// Compute matrix defining a position of pos with +Y axis is pointing at 'at'
static void lookAt(pfVec3 &pos, pfVec3 &at, pfMatrix &mat)
{
pfVec3 v;
static pfVec3 yaxis(0.0f, 1.0f, 0.0f);
// v is direction vector from dcs to 'at'
v = at - pos;
v.normalize();
// Rotate y-axis onto v
mat.makeVecRotVec(yaxis, v); // rotational part
mat.setRow(3, pos);
}
-- Scott McMillan | HT Medical, Inc. | Developing medical VE's scott++at++ht.com | http://www.ht.com | surgical simulations Ph: 301-984-3706 |6001 Montrose Rd., #902| and surgery simulation Fax: 301-984-2104 | Rockville, MD 20852 | creation tools.======================================================================= List Archives, FAQ, FTP: http://www.sgi.com/Technology/Performer/ Submissions: info-performer++at++sgi.com Admin. requests: info-performer-request++at++sgi.com
This archive was generated by hypermail 2.0b2 on Mon Aug 10 1998 - 17:55:16 PDT