PDA

View Full Version : Align Camera with face normal...How?


Gibbz
06-17-2006, 06:28 AM
Ok im trying to align the camera with the face normal usig the following...
What am i doing wrong? It seems to work on faces that are flat against x, y, z but soon as they are rotated it stops working...


myViewMatrix = viewport.getTM()
myOriginalCoordSystem = getCoordCenter()
toolMode.coordsys #local --set local coords
myLocalTransform = getTransformAxis myObj 0 --get transform matrix
viewport.setTM (myLocalTransform) --set camera to transform matrix...
max zoomext sel all

hblan
06-19-2006, 01:40 PM
1. get face center .
2. get face normal .
3. camera `s dir = face normal . -- be care , the direction of the camera is inverse direction of the camera view .
4.get camera`s lens distance . or just use ur own distance .
5. caculate the position for camera , should be "faceCenter + (faceNormal * lens distance )"
....

and more if u like ..

if the camera is a target camera , it will be more easy to do this . ,just put the target of camera to the face center ...

maybe helpful

CGTalk Moderation
06-19-2006, 01:40 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.