primitive properties lookat

   1153   3   2
User Avatar
Member
64 posts
Joined: July 2005
Offline
How do you point primitives towards another object?
I've tried with primitive properties look at and my badly formed vex.
Image Not Found

Sorry I'm sure that I am missing the obvious.
Edited by GrahamDClark - Dec. 12, 2022 16:47:34

Attachments:
Prims_lookAt_point_fail_GDC.hipnc (144.7 KB)

User Avatar
Member
359 posts
Joined: April 2017
Offline
Here's one way to do it. I'm using dihedral() in a prim wrangle to compute the matrix that would rotate each primitive's normal to face the vector you want. I'm also binding the center of each primitive to a temporary attribute... this is because when you multiply a point by a 3x3 matrix, you need to make sure the center of rotation is at the origin. Once that's done, I promote the attributes to points, then use a point wrangle to move each primitive's points so that the center is at the origin, multiply by the calculated matrix, then move back to the original pivot position.

Attachments:
Prims_lookAt_point_fail_GDC_toadstorm.hipnc (152.9 KB)

MOPs (Motion Operators for Houdini): http://www.motionoperators.com [www.motionoperators.com]
User Avatar
Member
64 posts
Joined: July 2005
Offline
Awesome, always loved your site and MOPs.
I changed one part so the prims faced the target more and the geo could be moved.

//vector target = normalize(point(1, "P", 0));
vector p0 = point(1,'P',0);
vector target =normalize(p0-@P);

Thank you again, hours of pain lifted.
Image Not Found
Edited by GrahamDClark - Dec. 12, 2022 18:21:01

Attachments:
Prims_lookAt_point_fail_GDC2_toadstorm.hipnc (153.3 KB)

User Avatar
Member
359 posts
Joined: April 2017
Offline
Oh right, duh. Forgot to include @P in the target vector. Thanks for catching that!
MOPs (Motion Operators for Houdini): http://www.motionoperators.com [www.motionoperators.com]
  • Quick Links