Reputation: 61
I need to know the direction that a giving camera is looking at but i can't find a way to get it.Is there a way to get some kind of vector that tells which direction the camera is pointing to(just like there is an up vector telling the camera's up direction)?
Upvotes: 0
Views: 1488
Reputation: 12208
You can also get the camera's worldMatrix using xform. The 3rd row of the camera matrix is the reverse of the camera vector
camera_z = cmds.xform("persp", q=True,m=True, ws=True)[8:11]
forward = [i * -1 for i in camera_z]
Upvotes: 2
Reputation: 1548
camera is looking on
centerOfInterest = cmds.camera(cameraShape, q=True, centerOfInterest=True)
camera world up vector
worldUp = cmds.camera(cameraShape, q=True, worldUp=True)
check the camera docu
Upvotes: 0