Help, @orient "360 degree" problem
1371 6 0- hign
- Member
- 21 posts
- Joined: Feb. 2022
- Offline
for some reason, I need to use @orient to “rotate” copy-to-points’ orient
at most of time, the vex script works
but if the sphere’s segment is 6,12,24…, when they hit 360 degree(or 0? I’m not sure)
the problem rise (like the pig-heads in picture, they have “opposite” direction)
why this problem happens?
And how to fix it?
Thank you for you help
at most of time, the vex script works
but if the sphere’s segment is 6,12,24…, when they hit 360 degree(or 0? I’m not sure)
the problem rise (like the pig-heads in picture, they have “opposite” direction)
why this problem happens?
And how to fix it?
Thank you for you help
- tamte
- Member
- 8555 posts
- Joined: July 2007
- Offline
- hign
- Member
- 21 posts
- Joined: Feb. 2022
- Offline
tamte
that code looks like you were trying to throw someone off of your scent
I genuinely got lost
try thisvector up = {0,1,0}; @orient = quaternion( maketransform( normalize(v@N), normalize(up) ) );
I’m a beginning leaner of vex(), the reply really helps me!!
Thanks a loooooooooot !!
As a beginner, still have some doubts in my mind, like
The first one
Still want to know,
Because I’m studying the function like quaternion(),cross(), qmultiply()…..
I really want to know
Why I rotate one axis, then the other, it works, except the 360 degree points
And ,how can I fix it(of course maketransform been learned)(for other scenario or example )
I think if I do not understand the reason, the same problem will happen again and again
Second,
The maketransform don’t work very well with the top and bottom points, witch the N and up axis is the same
If I need, how can I fix this in a good way ?
Thanks again!!!!
Edited by hign - March 3, 2023 22:42:20
- willh
- Member
- 134 posts
- Joined: Dec. 2006
- Offline
- Digipiction
- Member
- 166 posts
- Joined: March 2014
- Offline
The poles will typically give you problems because the cross product between identical vectors is 0, i.e. not a valid axis. You can check the dot product between the vectors, and if it's 1, then you'll want to choose a different second vector. So something like:
vector up = set(0, 1, 0); if (dot(v@N, up) == 1) up = set(1, 0, 0); vector side = cross(v@N, up);
- derrick
- Staff
- 329 posts
- Joined: July 2005
- Offline
hign
I really want to know
Why I rotate one axis, then the other, it works, except the 360 degree points
And ,how can I fix it(of course maketransform been learned)(for other scenario or example )
I think if I do not understand the reason, the same problem will happen again and again
The problem with your original code is how to handle situations when @newz and @mytan point in opposite directions. In these situations, dihedral() will return an arbitrary rotation that will map @newz onto @mytan but you want to further constrain it to a rotation that will keep the @N direction unchanged.
Edited by derrick - March 20, 2023 10:13:31
- hign
- Member
- 21 posts
- Joined: Feb. 2022
- Offline
-
- Quick Links