I need distance between two geometry...

   1082   3   0
User Avatar
Member
407 posts
Joined: Aug. 2015
Offline
Hi;

I want to retrieve distance between two geometry, and apply the result to rotation of one of them.
I tried to use “distance” expression function but it gives me the absolute value (cause I need +|- of the rotation).
Is there any function for this purpose?

Thanks.

Attachments:
distance.hip (95.6 KB)
distance.jpg (324.7 KB)

Masoud Saadatmand (MSDVFX)
User Avatar
Member
670 posts
Joined: Sept. 2013
Offline
Hi Masoud,

just subtract the current distance and it will go above or below 0 as soon as you move the objects.
https://procegen.konstantinmagnus.de/ [procegen.konstantinmagnus.de]
User Avatar
Member
407 posts
Joined: Aug. 2015
Offline
Konstantin Magnus
Hi Masoud,

just subtract the current distance and it will go above or below 0 as soon as you move the objects.


You mean something like this? :

distance(chw(“tx”),ch(“ty”),ch(“tz”), ch(“../sph/tx”),ch(“../sph/ty”),ch(“../sph/tz”)) - {ch(“tx”),ch(“ty”),ch(“tz”}

It make error!
Masoud Saadatmand (MSDVFX)
User Avatar
Member
670 posts
Joined: Sept. 2013
Offline
You got a bracing error and some unnecessary ‘w’:

90 * (1.5 - distance(ch("tx"),ch("ty"),ch("tz"), ch("../sph/tx"),ch("../sph/ty"),ch("../sph/tz")) )

90 means degrees per 1 unit distance
1.5 is the initial distance to start with 0 degrees rotation

Also look into CHOP constraints in case you need more control.
https://procegen.konstantinmagnus.de/ [procegen.konstantinmagnus.de]
  • Quick Links