PDA

View Full Version : copy camera and target?


3rd Dimentia
06-04-2007, 03:30 PM
I know this is going to be simple, but I've been trying for a while and figure it out... I need to clone a camera and it's target. If I just do

baseCam = $Camera01
baseCamL = copy baseCam

it only copies the camera and leaves both cameras with the same target...

Or do I have to copy the target seperately and assign it as the target for the new camera with some more script? I guess I'm just looking for the most elegant way to do it.

Thanks.

kikialex
06-04-2007, 04:05 PM
new_cam = Targetcamera name:"new_cam"
new_tg = TargetObject name:"x1"
$x1.lookat = $new_cam
$new_cam.transform = $Camera01.transform
$x1.transform = $Camera01.Target.transform

Bobo
06-04-2007, 04:22 PM
I know this is going to be simple, but I've been trying for a while and figure it out... I need to clone a camera and it's target. If I just do

baseCam = $Camera01
baseCamL = copy baseCam

it only copies the camera and leaves both cameras with the same target...

Or do I have to copy the target seperately and assign it as the target for the new camera with some more script? I guess I'm just looking for the most elegant way to do it.

Thanks.


maxops.cloneNodes #($Camera01)

will clone both the camera and its target. Read about the method in the MAXScript Reference in the "maxOps Interface" topic.

You could also get the result using:

maxops.cloneNodes #($Camera01) newNodes:&theNewNodes
true
theNewNodes
#($Target_Camera:Camera02 @ [-15.615925,-153.093109,124.999992], $Target:Camera02.Target @ [-51.946758,-69.090828,56.412430])



Also note that under "Node Common Properties, Operators, and Methods" topic, it says the following (pay attention to the NOTE part):

copy <node> -- mapped

reference <node> -- mapped

instance <node> -- mapped

All the clone operations can take any of the standard node creation optional keyword arguments which are applied after the node has been copied.

These functions clone all the original node's transform controllers and keys and the visibility controller and its keys if a visibility track has been assigned.

Note:

maxOps.cloneNodes (http://forums.cgsociety.org/Interface_maxOps.htm#maxOps.CloneNodes) is the preferred way to copy, instance, or reference nodes. Node interdependencies are retained, and more of the node properties are copied across.



So it is not like it is not documented or something... ;)

3rd Dimentia
06-05-2007, 04:21 AM
Thank you so much for that. I appreciate your time and effort to help out. It is indeed documented, but finding things in the documentation is what I seem to have difficulty with. Or often knowing what to be looking for in the first place. You've definately set me on the right path though.

I have to mention that your DVD's have helped me a lot with learning maxscript so far. I have a long way to go though.

Thank you,

Cg.

Bobo
06-05-2007, 05:17 AM
...finding things in the documentation is what I seem to have difficulty with. Or often knowing what to be looking for in the first place.


Any suggestions for improvements in the documentation are welcome!

Also make sure you read all Frequently Asked Questions in the Reference (or at least their topics) - they are based on threads on this and other forums and can be very helpful in some situations.
Adding a FAQ entry about copying a camera+target might be actually a good idea...

CGTalk Moderation
06-05-2007, 05:17 AM
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.