Hello,
is it possible to find the distance between my camera and an object in Houdini ?
thanks,
bern
distance between object and camera
6870 4 2-
- Bernard
- Member
- 523 posts
- Joined: July 2005
- Offline
-
- edward
- Member
- 7244 posts
- Joined: July 2005
- Offline
-
- malexander
- Staff
- 4944 posts
- Joined: July 2005
- Offline
-
- Andy_23
- Member
- 886 posts
- Joined: March 2014
- Online
-
- No_ha
- Member
- 74 posts
- Joined: Sept. 2018
- Offline
I created myself an HDA that calculates the distance between the camera and a Sphere primitive and then sets the focus distance on the camera.
In my case I did it through an attribute wrangle.
You can read the World transform of the camera and the object you want and then use the cracktransform function to get only the position vector of the two. Then you calculate the distance.
I’m not in front of my computer right now so I can’t copy the code. Let me know if this is what you need and can’t figure it out.
I certainly have never any clue on how the cracktransform function works. I just copied it once from another example. So if somebody in the meantime wants to explain the syntax behind that I would be very grateful 😁
In my case I did it through an attribute wrangle.
You can read the World transform of the camera and the object you want and then use the cracktransform function to get only the position vector of the two. Then you calculate the distance.
I’m not in front of my computer right now so I can’t copy the code. Let me know if this is what you need and can’t figure it out.
I certainly have never any clue on how the cracktransform function works. I just copied it once from another example. So if somebody in the meantime wants to explain the syntax behind that I would be very grateful 😁
Edited by No_ha - June 3, 2022 01:55:22
-
- Quick Links