PDA

View Full Version : Camera Target from Target Camera


Alex Morris
05-23-2003, 12:24 PM
Hi guys,

Trying to define a function for camera alignment to predefined points
Once I have the camera selected and defined as a variable what's the best way of getting the camera target without user input?

for instance:

c = selectByName title:"Choose Camera" single:true
t = ? (camera target node from the above variable?)

ps. a filter function for cameras in the above dialogue would be handy as well

LFShade
05-23-2003, 06:14 PM
I think one of the scripts in the blur script pack selects targets based on their camera. You could probably use that to figure out how it's done. If you don't have one of the BSPacks, you can try www.scriptspot.com.

Bobo
05-23-2003, 09:46 PM
Originally posted by Alex Morris
Hi guys,

Trying to define a function for camera alignment to predefined points
Once I have the camera selected and defined as a variable what's the best way of getting the camera target without user input?

for instance:

c = selectByName title:"Choose Camera" single:true
t = ? (camera target node from the above variable?)

ps. a filter function for cameras in the above dialogue would be handy as well



Hi Alex,

Every targeted object (Spot, Camera, Tape etc.) has a .target property pointing at the actual target object.


fn camera_filter obj = ( superclassof obj == Camera )
c = selectByName title:"Choose Camera" single:true filter:camera_filter
t = c.target


Some additional details you might need someday:
The TargetObject() constructor lets you create your own targets to assign to Cameras, Lights etc when creating them yourself.
TargetObject is of Geometry class which might be important when collecting Lights or Cameras. When accessing the Lights or Cameras global array, the targets will be listed there, but not being a Light or Camera class, they could cause your problems.
For example, to collect all Cameras but no targets, you would have to say

cam_array = for c in Cameras where classof c != GeometryClass collect c

Compare to

cam_array = Cameras as array

which will give you both Cameras and their Targets...

Alex Morris
05-28-2003, 02:29 PM
Thanks for the quick response guys, I'll try incorporating this in the next few days and repost the whole thing.

CGTalk Moderation
01-15-2006, 05:00 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.