I ran with my head more or less the whole day against a brick wall as I couldn't find a proper solution. Finally I managed, but I'd like to understand it a bit better.
For an ICE rig I need to rotate a few bones around the wrist controler. Actually it's parenting what I'm looking for, but as these bones all receive their position via ICE I need to parent them in an ICE way.
The wrist controler is placed somewhere in space with rotations applied. All the bones and the controlers are in place for the general pose.
It's easy (for me) to rotate vectors around a null for example if there is no rotation applied to the null. At least in the rig I need to make sure that the bones don't get rotated if the controler hasn't been rotated out of its original state. But as there is already rotation applied, I need to somehow "null/rest" this rotation. That's what I couldn't figure out the whole day, unless I did have the idea to parent a helper null at the exact position of the controler, but without its rotation. So I somehow get a rotation value in space for my controler, which is in a neutral state. Now the bones stay in place in relation to their controler if the controler gets rotated.
BUT, how do I do this without my helper null? Actually the helper just represents the wrist rotation in a slightly different fashion. How could I do this with just the controler? All my attempts to subtract, add and increment rotations failed.
Can somebody please help me out in order to understand ICE and transforms a bit better?
Thanks in advance.
Vector math (madness)
-
grahamef
- Posts: 281
- Joined: 23 Jun 2009, 19:01
Re: Vector math (madness)
Rotations are special. If you want to compose rotations, then don't use Euler angles. Instead, convert them to another data type and do any one of the following:
- add or multiply axis and angle values (the "rotation" data type)
- multiply quaternions
- multiply matrices
Since you are dealing with whole transforms anyway, it's probably easiest to stick with matrices in this case.
- add or multiply axis and angle values (the "rotation" data type)
- multiply quaternions
- multiply matrices
Since you are dealing with whole transforms anyway, it's probably easiest to stick with matrices in this case.
-
Pancho
- Posts: 659
- Joined: 19 Sep 2010, 09:28
Re: Vector math (madness)
Tried everything.
The point is, how to imitate the helper null which has the "clean/neutral" rotation values. Somehow I would need to subtract an initial value from the wrist control, but I couldn't figure out how. If I subtracted the initial value from the current value, the new rotation is not oriented like the current rotation, but along the z-axis. So I rotate my "parented" objects on the wrong axis.
I spent hours to get it done, but without success.
The point is, how to imitate the helper null which has the "clean/neutral" rotation values. Somehow I would need to subtract an initial value from the wrist control, but I couldn't figure out how. If I subtracted the initial value from the current value, the new rotation is not oriented like the current rotation, but along the z-axis. So I rotate my "parented" objects on the wrong axis.
I spent hours to get it done, but without success.
-
grahamef
- Posts: 281
- Joined: 23 Jun 2009, 19:01
Re: Vector math (madness)
In general, you don't subtract rotations. Instead you invert and then multiply. Also, the order of multiplication makes a difference.
But if I understand you correctly, you could just take the controller's position and scale and plug them into SRT to Matrix. The resulting transform is equivalent to what the null's transform would be, but without the null actually in the scene.
But if I understand you correctly, you could just take the controller's position and scale and plug them into SRT to Matrix. The resulting transform is equivalent to what the null's transform would be, but without the null actually in the scene.
-
Pancho
- Posts: 659
- Joined: 19 Sep 2010, 09:28
Re: Vector math (madness)
The point is that all "parenting" needs to be done in ICE. And the childs are never in the center of their parents, like satellites in relation to the earth.
For example, if my earth with its satellites, rotated around its own axis somewhere in space, needs to be aligned with a null, also rotated somewhere in space, how would I rotate and translate my earth?
Could please somebody show me an ICE tree explaining how to figure out the rotation difference I need to figure out in order to rotate the earth and each child so it matches the orientation of the null?
Sure, I could match the earth itself pretty easily by "copying" the nulls kine.global transforms, but how do I change the position of the earth satellites? Rotate vector might help, but how do I get the rotation for this task???
PLEASE?!
P.S.: Simple parenting would work in a non ICE environment, but as all satellites get their transforms via ICE, the "parenting" needs to be ICEed too.
For example, if my earth with its satellites, rotated around its own axis somewhere in space, needs to be aligned with a null, also rotated somewhere in space, how would I rotate and translate my earth?
Could please somebody show me an ICE tree explaining how to figure out the rotation difference I need to figure out in order to rotate the earth and each child so it matches the orientation of the null?
Sure, I could match the earth itself pretty easily by "copying" the nulls kine.global transforms, but how do I change the position of the earth satellites? Rotate vector might help, but how do I get the rotation for this task???
PLEASE?!
P.S.: Simple parenting would work in a non ICE environment, but as all satellites get their transforms via ICE, the "parenting" needs to be ICEed too.
-
Pancho
- Posts: 659
- Joined: 19 Sep 2010, 09:28
Re: Vector math (madness)
O.k.
I found the solution after stumbling across an example for the invert/multiply way.
All my satellites are in a group. So I first multiply their matrix array with the inverted matrix of their reference system (earth). This "resets" the rotation. The satellites are now orbiting around the center of my 3d space. Afterwards I multiply this matrix array again, now with the matrix of my new reference system. And voila, everythings works fine. My mistake was to think that I would need to subtract the matrix from one reference system from the other and then use this "difference" matrix to change the transforms of the satellites.
Thanks for the multiply tip!
I found the solution after stumbling across an example for the invert/multiply way.
All my satellites are in a group. So I first multiply their matrix array with the inverted matrix of their reference system (earth). This "resets" the rotation. The satellites are now orbiting around the center of my 3d space. Afterwards I multiply this matrix array again, now with the matrix of my new reference system. And voila, everythings works fine. My mistake was to think that I would need to subtract the matrix from one reference system from the other and then use this "difference" matrix to change the transforms of the satellites.
Thanks for the multiply tip!
-
Mathaeus
- Posts: 1778
- Joined: 08 Jun 2009, 19:11
- Location: Zagreb, Croatia
Re: Vector math (madness)
some rule is to always do local transform first, in world origin, then you multiply this with 'parent' transform. If you want to do that later, let's say to rotate the already 'parented' satellite around 'own' axis, basically there are two ways:
1. move it back to world origin (subtract position from parent] , rotate and move back
2. just 'omit' to multiply rotation when 'parenting'. Convert matrix to SRT and so on..
I think it's not complicated as it's looking at first. However, making an ICE replica of all options that some standard SI constraint has, requires a *lot* of nodes.
btw just sow you already found the trick...
1. move it back to world origin (subtract position from parent] , rotate and move back
2. just 'omit' to multiply rotation when 'parenting'. Convert matrix to SRT and so on..
I think it's not complicated as it's looking at first. However, making an ICE replica of all options that some standard SI constraint has, requires a *lot* of nodes.
btw just sow you already found the trick...
-
Pancho
- Posts: 659
- Joined: 19 Sep 2010, 09:28
Re: Vector math (madness)
It's indeed very simple. But not if you think that you need to subtract the rotation in order to get the new rotation, like you would do with vectors. Especially if the rotate vector node sends you of in the wrong direction.
To realize that you need to rotate everything back to the origin and then perform a second transform is the difficult part. The ICE tree for this operation couldn't be more simple.
Thanks to all of you!
To realize that you need to rotate everything back to the origin and then perform a second transform is the difficult part. The ICE tree for this operation couldn't be more simple.
Thanks to all of you!