Jump to content
Sign in to follow this  
Atom

[SOLVED]VEX Rotate Instances?

Recommended Posts

Atom    516

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
Atom    516

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
3dome    30

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
Atom    516

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  

×