Notifications
Clear all

[Closed] Align Camera with face normal…How?

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
1 Reply
  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 cameras lens distance . or just use ur own distance .
  4. 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