Post transform look-at constraint orientation

   2171   5   0
User Avatar
Member
70 posts
Joined: March 2016
Offline
Hi,

In the attachments I have added the following problem;

On the left side I have the object I want to constraint oriented in a specific way, but when I give it a look-at constraint (in the middle), it snaps back to default orientation. It also doesn't rotate (I made it a single axis look-at) around the oriented Y-axis, but around the world-space Y-axis.

Anyone who knows how to get this fixed?

The third (most right) object is the way I want the object to be constraint, but this is done by a simple expression, so no look-at constraint.

Cheers,
Chris

Attachments:
LookAt_Help.jpg (461.3 KB)
LookAt_Constraint_Help.hipnc (343.0 KB)

https://www.youtube.com/@Klonkel
User Avatar
Member
536 posts
Joined: March 2014
Offline
using vex.
The lookat() function takes two arguments, first one is called “from” (aka the source point, in your case the pivot of your geo), the second one is “to” (aka the target Position).

But keep in mind that this applies only to one axis (Z).
This means that any local Rotation around the Z-axis is not taken into Account.

1. Initialize those two from and to Positions.
2. Initialize a 3x3 Rotation Matrix using the lookat function.
3. Translate your geo to origin.
4. Multiply your P by the 3x3 matrix
5. Translate geo back to where it came from.
Done.

Not in Front of houdini, out of my head.
Hope that helps.
Fuat
Edited by fuat - Aug. 22, 2019 13:59:40
Fuat Yüksel
FX Supervisor | RISE Visual Effects Studios
User Avatar
Member
70 posts
Joined: March 2016
Offline
fuat
using vex.

1. Initialize those two from and to Positions.
2. Initialize a 3x3 Rotation Matrix using the lookat function.
3. Translate your geo to origin.
4. Multiply your P by the 3x3 matrix
5. Translate geo back to where it came from.

Thanks for your reply Fuat!

But I am still wondering, when doing it with vex it becomes a SOP transformation, so a mesh deformation right? Having a look-at constraint by CHOPS is all OBJ transformation which is much faster than having the geometru ‘deform’ constantly whilst it could(should) actually be done by an OBJ rotation?

Chris
https://www.youtube.com/@Klonkel
User Avatar
Member
536 posts
Joined: March 2014
Offline
I believe the lookat chop uses a World space Matrix Transformation. Sops work on Geometry, hence a point deformation, since you multiply a vector P by a Matrix.
But if you want, you could do the same in Sops. There is a optransform() function which returns a Matrix in global space. If you Multiply this with your 3x3, then you have a (Matrix) Transformation rather than a (point) deformation.
I never did a speed comparison of both though.
I only use Obj Level transforms if i really have to. Aka almost never.
Edited by fuat - Aug. 23, 2019 07:14:44
Fuat Yüksel
FX Supervisor | RISE Visual Effects Studios
User Avatar
Member
70 posts
Joined: March 2016
Offline
fuat
I believe the lookat chop uses a World space Matrix Transformation. Sops work on Geometry, hence a point deformation, since you multiply a vector P by a Matrix.
But if you want, you could do the same in Sops. There is a optransform() function which returns a Matrix in global space. If you Multiply this with your 3x3, then you have a (Matrix) Transformation rather than a (point) deformation.
I never did a speed comparison of both though.
I only use Obj Level transforms if i really have to. Aka almost never.

Ah I see, I'll try to see if I can find a difference in speed.

I usually do the same, but since I am working on a rig for an imported FBX model, OBJ level, chops and constraints seemed the way to go rig it.
https://www.youtube.com/@Klonkel
User Avatar
Member
536 posts
Joined: March 2014
Offline
Chris Klinkhamer
I usually do the same, but since I am working on a rig for an imported FBX model, OBJ level, chops and constraints seemed the way to go rig it.

Oh of course! Fbx is definitely Obj Level transforms.
You should have mentioned before…
Fuat Yüksel
FX Supervisor | RISE Visual Effects Studios
  • Quick Links