Welcome to od|forum

Register now to gain access to all of our features. Once registered and logged in, you will be able to contribute to this site by submitting your own content or replying to existing content. You'll be able to customize your profile, receive reputation points as a reward for submitting content, while also communicating with other members via your own private inbox, plus much more! This message will be removed once you have signed in.

Sign in to follow this  
Followers 0
Atom

[SOLVED]VEX Rotate Instances?

Hi All,

I have this mountain sphere where I have scattered a few copies of the letter T upon.

I want to be able to rotate each instance along the vertical axis of the letter T, so they spin while aligned to the sphere.

I am constructing orientation using the polyframe node but I want to control the secondary rotation via VEX.

Does anyone know the VEX code for rotating along a single axis while maintaining the original orientation setup by the polyframe?

Untitled-1.jpg

ap_VEX_random_align_to_surface.hipnc

Edited by Atom

Share this post


Link to post
Share on other sites

Thanks for taking a look at my problem file. That is almost it, however, when I install your code in my scene the rotation occurs on the wrong axis. I wonder if this is due to the scatter after the polyframe? In your scene if I scatter points, instead of using the surface points the solution is lost as well.

Do you know how to migrate the rotational influence to the other axis?

I tried swapping X and Z but that did not work either.

p@rot = quaternion(@Time, @N);
float rx, ry, rz;
rx = p@rot.x;
ry = p@rot.y;
rz = p@rot.z;
p@rot = set (rz,ry,rx);

 

rot_angle.gif

Edited by Atom

Share this post


Link to post
Share on other sites

why don't you use your up-vector instead of @N?
if I got this right, p@rot = quaternion(@Time, v@up); in your attribwrangle_INSTANCE should do the trick

and remove those other lines

Edited by 3dome

Share this post


Link to post
Share on other sites

When I add scatter after polyframe it still works in my file. Make sure to keep the * in point attributes, though.

Share this post


Link to post
Share on other sites

Thanks everyone, the v@up was the key.

This works for my scene.

float angle = ch("../rot_amount");
float rand = fit01(random(@ptnum),0,angle);
p@rot = quaternion(radians(rand), v@up);

 

ap_VEX_random_align_to_surface.hipnc

rot_angle.gif

Edited by Atom

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0