Jump to content

Rotation around it's own axis?


Recommended Posts

Hi tere,

I am trying to solve a rotation around it's own axis on a fractured geometry which has an @name attribute. Basically, each primitve which has an identical @name attribute should rotate"together" as one unit around it's own axis, based on a falloff which is created with a group node.

I have tried two routes, one as via VEX and ther other with a Foreach-Node. In both cases, I am not able to rotate them. 

How would you solve this in VEX?  Thanks for any help in advance!

odForce_pivotRotation_VEX.hiplc

Link to comment
Share on other sites

The first problem is that the rotation group is a primitive group and not a point group.
Secondly, a way you get everything to move as a whole unit is to pack it.

It is unclear what axis you mean with its own axis.

I have a setup that should work in my mind, but in actuality it doesn’t work for seemingly 0 reason.
For some reason, the packed primitives don’t respond to the qrotate when given a vector programmatically.

If anyone can tell us why that doesn't work, that would be awesome.
I fixed the problem by unpacking them. They can be packed again later if needed

odForce_pivotRotation_packed_VEX2.hiplc

Edited by Drunkenpanda
  • Like 1
Link to comment
Share on other sites

Here's a way to figure out what to do to edit a packed prim's rotation.

Rotate it with a transform node, then search through the attributes to see where your values are stored !
Spoiler alert, a packed primitive has a primitive intrinsic called transform, which is indeed what the transform node edits.

You can use setpackedtransform() to edit it in VEX.

image.thumb.png.fdf061ee0511cb4689c46cd77fd9e6a3.png

matrix3 m = primintrinsic(0, "transform", @primnum);
// Enable this line and see that the transform node is ignored.
// This is expected, since it will overwrite the transformation that is already applied.
//m = ident();

rotate(m, radians(45), {0,1,0});

setpackedtransform(0, @primnum, m);
//setprimintrinsic(0, "transform", @primnum, m); // does the same as setpackedtransform()

See https://vfxbrain.wordpress.com/2020/07/09/how-to-re-apply-packed-transform/ for more information.

Edited by Alain2131
  • Like 3
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...