Vex: rotate orient attribute? [{SOLVED]}

   440   4   1
User Avatar
Member
1035 posts
Joined: April 2017
Offline
Hi!

I often use a matrix to rotate vectors but I'd like to do the same thing to an @orient. I just need it to rotate around the Y axis over time.

-Olivier
Edited by olivierth - July 23, 2024 11:02:52
User Avatar
Member
1035 posts
Joined: April 2017
Offline
Arg! I found how to rotate the @orient with this:

matrix3 m = ident();
rotate(m, chf("rotate"), set(0,1,0));
@orient = quaternion(m);

... but it wasn't rotating the geo in the viewport. It's an instance so I think I need to rotate the intrinsic "transform" instead. I'll try to figure this out..
Edited by olivierth - July 23, 2024 10:56:34
User Avatar
Member
1035 posts
Joined: April 2017
Offline
Ah! ok, got it. The trick was to use this on a primitive wrangle:
matrix3 m = primintrinsic(0, "transform", @primnum);
rotate(m, chf("rotate"), set(0,1,0));
setprimintrinsic(0, "transform", @primnum, m, "set");

That way, I start by reading the "transform" matrix from the primitive intrinsics. I rotate that matrix and finally I write the new matrix to override "transform".
Edited by olivierth - July 23, 2024 11:03:48
User Avatar
Member
442 posts
Joined: Nov. 2016
Offline
Are you using copy to points? Modifying @orient will work if you perform it on the points upstream, but not on the geo once it's been copied.
User Avatar
Member
1035 posts
Joined: April 2017
Offline
No, its not from a copy to point. It's from someone's scene I don't fully understand. But the script to modify the "transform" intrinsic worked perfectly!

-Olivier
  • Quick Links