MotionBuilder Forum
Welcome to Autodesk’s MotionBuilder Forums. Share your knowledge, ask questions, and explore popular MotionBuilder topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

camera from perspective

5 REPLIES 5
Reply
Message 1 of 6
mondog_1
612 Views, 5 Replies

camera from perspective

Does anyone know if the Perspective camera's translation/rotation is exposed ot queryable? i'm trying to replicate the funcionality that Max has when you create a new camera from the current perspective view.

Thanks
Mondo
5 REPLIES 5
Message 2 of 6
jhn
in reply to: mondog_1

In motionbuilder you're always in a camera... producers perspective is a camera too, so if you could figure out which camera is current, you should be fine, I think..

-Johan
Message 3 of 6
_KxL_
in reply to: mondog_1

to get current camera use:

lSystem = FBSystem()
lCurrentCamera = lSystem.Renderer.CurrentCamera


KxL
Message 4 of 6
mondog_1
in reply to: mondog_1

Hi,

So it's taken me a while to re-visit this task! Thanks KxL for the tip, you got me on the right track.

I have the script working now and everything's perfect as long as i don't use the Producers persepective. No matter where i place it, i get the same values for T and R. T: (0, 145, 30) R: (-90, 80, -90). I really want this to work from the Producers perspective as this is how we sight new shots.

I've tested it via through one of the script created cams and it works fine. Is there any way to specifically expose the producers perspective transforms?

This is where i'm at script-wise:

from pyfbsdk import *

#Cast current camera - should be perspective view
lSystem = FBSystem()
lCurrentCamera = lSystem.Renderer.CurrentCamera

#Declare some variables to get transformation of Perspective Camera
position = FBVector3d()
rotation = FBVector3d()

#Query the current camera's position and rotation
lCurrentCamera.GetVector (position, FBModelTransformationMatrix.kModelTranslation)
lCurrentCamera.GetVector (rotation, FBModelTransformationMatrix.kModelRotation)

#debug infos
print "translate X = %s" % position
print "translate Y = %s" % position
print "translate Z = %s" % position

print "rotate X = %s" % rotation
print "rotate Y = %s" % rotation
print "rotate Z = %s" % rotation

# Create New Camera, Make it visible, set it up with the values required
lNewCamera = FBCamera("Camera")
lNewCamera.Show = True

#Set it's position to match the current camera
lNewCamera.SetVector( position, FBModelTransformationMatrix.kModelTranslation)
lNewCamera.SetVector (rotation, FBModelTransformationMatrix.kModelRotation)

lNewCamera.Selected = True

#Clear Local Variables
del( lSystem, lCurrentCamera, position, rotation, lNewCamera)


If i query
lCameraCurrent.Name
, it tells me that it's the producers perspective.

Any help would be much appreciated.

Thanks
Mondo
Message 5 of 6
_KxL_
in reply to: mondog_1

Problem is, that system cameras do not use those values. As for now I can't find a solution for your problem, but if I came with something useful I will post it here.

Cheers!
Message 6 of 6
djtomservo
in reply to: mondog_1

Firing this back up since I'm trying to do the same thing. I found a hack that worked in 2010, but sadly it doesn't seem to work in 2011. If you constrain Producer Perspective to itself, you can get back the actual .Translation, but again, this doesn't look like it works in 2011:(

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report