[Closed] copy camera and target?
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):
[left]copy <node> [color=green]– mapped[/color]
[/left]
[left]reference <node> [color=green]– mapped[/color]
[/left]
[left]instance <node> [color=green]– mapped[/color]
[/left]
[left]All the clone operations can take any of the standard node creation optional keyword arguments which are applied after the node has been copied.
[/left]
[left]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.
[/left]
[left]Note:
[/left]
[left]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.
[/left]
So it is not like it is not documented or something…
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
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.
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…