Cam with path object - get position

   7646   6   1
User Avatar
Member
30 posts
Joined: Aug. 2010
Offline
Hi,

I've set a cam to use a path object. The initial transform of the cam is tx/y/z=0, as the position in space is determined by the path object.

I want to calculate the distance of the cam to the lookat object, basically to set focus distance to this value.

How do I get the actual position of the cam (transformed to the path)?

Thanks for any help!

Regards,
Carsten
User Avatar
Member
30 posts
Joined: Aug. 2010
Offline
I've managed to get the distance via the expression

sqrt(dot(vtorigin(“/obj/cam_lookat”,“/obj/cam1”),vtorigin(“/obj/cam_lookat”,“/obj/cam1”)))

However, if I use this for focus distance, it works only after editing the expression. If I switch to another frame, the cam shows “infinite recursion” error.

How can I avoid that?

Regards,
Carsten

Attachments:
set_focus.hipnc (68.0 KB)

User Avatar
Staff
1182 posts
Joined: July 2005
Offline
Did you try the camera's focus handle? You can RMB-click on the camera's handle (when the Handle tool is active) and select Focus Handle. This gives you a handle for positioning the Focus Distance using the little cube and the F-Stop using the arrows.

You can then set keyframes on the parameters as needed.
Robert Magee
Senior Product Marketing Manager
SideFX
User Avatar
Member
192 posts
Joined: Nov. 2008
Offline
You can use the Object CHOP to return the distance between your target null or object and the camera. If you set the CHOP's Channel Range to Use Current Frame it will only cook one frame at a time like an expression. You can pull this value using the chop() expression or push it to your output parm with Export.

Good luck dude!

edit: added an example

Attachments:
focus_distance_path.hip (59.3 KB)

User Avatar
Member
30 posts
Joined: Aug. 2010
Offline
rmagee
Did you try the camera's focus handle? You can RMB-click on the camera's handle (when the Handle tool is active) and select Focus Handle. This gives you a handle for positioning the Focus Distance using the little cube and the F-Stop using the arrows.

You can then set keyframes on the parameters as needed.

Yep, I already tried that, but why do it manually ;-)

Regards,
Carsten
User Avatar
Member
30 posts
Joined: Aug. 2010
Offline
brianBurke
You can use the Object CHOP to return the distance between your target null or object and the camera. If you set the CHOP's Channel Range to Use Current Frame it will only cook one frame at a time like an expression. You can pull this value using the chop() expression or push it to your output parm with Export.

Good luck dude!

edit: added an example

Thanks a lot! Works perfectly.

Regards,
Carsten
User Avatar
Member
31 posts
Joined: June 2009
Offline
FYI, I just tried the CHOPs setup example. It'll error with the same infinite recursion error as soon as any of the objects are manipulated - if using a chops expression in the focus parameter. But, if you export from the CHOP net it appears to work just fine!
  • Quick Links