PDA

View Full Version : Dazed and confused by coordinatel systems - world, parent, local, etc. Ack!

 tredeger02-27-2006, 09:52 AMMy poor brain hurts. OK, so this is what i've done: Create a poly cone. Create a poly cube. Position constrain the cone to the cube. They are both located in 0,0,0 world space to start. Now, I change the cube's neutral pose position values, say Y = 10. Because I haven't changed to SRT values at all, the cube will move to the location of the neutral pose (the translation values are zero on the cube). Because the cone is position constrained, it goes too. Now both object centers are at 0,10,0. What I want is for the cone to remain where it started, at 0,0,0. Soooo... on the position constraint's property page, I go to the attach point tab and under the constraining object values I set Y=-10. The object stays in place. Great. Now, I make sure "affected by orientation is set to active in this same area. Now, if I rotate the cube, the cone will orbit the cube at a fixed distance. this is exactly what i want, it's as if the cone's pivot point where at the center of the cube. Here is where thing get all messy. That simple negative value relationship between the cube's neutral pose and the contstraint's "constraining object" values works perfectly if either "affected by orientation" is turned off OR the cube has rotation values of 0,0,0 and is aligned with world space. If affected by orientation is on (and it needs to be on to enable the orbiting behavior) and the cube is rotated a bit, then the coordinate system in which the cone translates is no longer aligned with world space. It's moving in the coordinate space of the rotated cube. My problem is that I can't figure out an expression to relate the cube's neutral pose to the constraining object X,Y, Z values that will properly compensate for the cubes rotation and allow the cone to translate in the exact opposite direction as the cube is shifted by changing it's neutral pose values. I think what I'm asking is how do I take a vector in the cube's parent space (the new neutral pose value) and translate that into a vector that can be applied to the cone's position constraint when it is affected by the constrainier's orientation, which is basically converting a vector in the cube's parent space to one in the cube's local space I think. Are those values easily calculated with the right expression? Something I can set up between the two sets of properties? All you geniuses, please proceed to bake my noodle and shed some light on this perplexing issue.
ThE_JacO
02-27-2006, 10:49 AM
I'm not 100% sure I understand the problem.
If I get what you mean, your request is having the position related to the constraining object's position but not by its orientation, and for the orientation of the constrained object use a constrain orientation.
Also remember that constraining always affects the object's global space, therefore voiding anything in any other space.

is that what you're after?

DimitrisLiatsos
02-27-2006, 12:29 PM
I don't get it too....u want ...

Parent r(p) <x,y,z> feeding for example ...slave with r(s) <-x,y,z> and so on with an expression?

tredeger
02-28-2006, 12:26 AM
I'm not surprised that you're confused, I'm completely confusing myself. I've actually started to try to approach this problem using parenting instead of constraints. I think it's easier to conceptualize but I'm still running into the same basic problem.

Let's say I create a nested relationship of objects that looks like this:

cube1 (Alice) is the parent of cube2 (Bob) which is the parent of cone1 (Charlie).

What I'm after is the following behavior: When I transform Bob using translate or rotate, Charlie should travel exactly the way you expect the child of a node to do. That isn't a problem at all. The thing I want to do however is animate Bob's neutral pose position values so that Bob's geometry changes location relative to the Alice coordinate system even as Bob's translation x,y, z values remain constant. BUT, when I do this, I want Charlie's position relative to Alice's coordinate system to remain fixed.

If I just think about it as all happening in Alice's frame of reference, what I'm trying to do is really straightforward- I want to move Bob by changing his neutral pose position value in one direction and the counter move Charlie by changing his translation values in an equal and opposite direction. The effect would be that Charlie seems to stay still in Alice's frame of reference while Bob moves.

The problem is that I'm running into the problem of resolving different coordinate systems. I'd like to have a better understanding of how to approach this issue in general really. When I change Bob's neutral pose values, he moves relative to his parent's (Alice) coordinate system. But putting translation values on Charlie to compensate for Bob's movement causes Charlie to move relative to his parent's (Bob) coordinate system. So when Bob has been rotated around, instead of Charlie moving in the opposite direction, he moves in a direction determined by Bob's orientation relative to Alice.

Changing Bob's translation or neutral pose position values always moves him orthogonally with respect to Alice, so what I want to do is basically determine a vector in Alice's coordinate system that is of equal magnitude to Bob's shifting but in the opposite direction. Then I need to convert those values to a vector that can be added to Charlie's local translation values in Bob's coordinate space. So if anyone knows how to handle this vector coordinate system conversion, I would be deeply deeply grateful for the help.

I'm trying to leverage Bob's neutral pose and compensating with Charlie's translation as a way of moving Bob around while keeping Charlie still but then being able to have Charlie behave completely normally as a child node when Bob is transformed by SRT values.

By the way, I cannot get the animated over time behavior I'm after using the child compensate button in the MCP.

If this explanation still lacks clarity, let me know and I'll try to put up illustrations or something. Thanks a ton everyone for the generous assistance.

ThE_JacO
02-28-2006, 12:41 AM
sorry, I still don't get it.
english isn't my first language, and maybe it's me having problems following the sentences...
but have you ever managed doing this in maya? if that's the case just put together a video of what you want please, and it will be a lot easier to help you.
pictures will do if you can't host a video :)

DimitrisLiatsos
02-28-2006, 12:43 AM
cube1 (Alice) is the parent of cube2 (Bob) which is the parent of cone1 (Charlie).

What I'm after is the following behavior: When I transform Bob using translate or rotate, Charlie should travel exactly the way you expect the child of a node to do. That isn't a problem at all. The thing I want to do however is animate Bob's neutral pose position values so that Bob's geometry changes location relative to the Alice coordinate system even as Bob's translation x,y, z values remain constant. BUT, when I do this, I want Charlie's position relative to Alice's coordinate system to remain fixed.
......

Hmmm..isn't that ..if i understood correctly ...a selectable switch on/off of who is parent of (Charlie)....one minute u want as Parent Alice and the other u want Bob...OR both...which u have already!....I got it right?

tredeger
02-28-2006, 04:53 PM
Thanks again to you guys for your assistance. Just trying to explain it here has helped me greatly clarify and simplify my thinking in this matter. Still searching for a solution though.

Basically, I now realize that what I really want to do is take a position vector whose values I can easily determine in one coordinate space and add them to the position values of an object (the child cone) that exists in a different coordinate space. I also know how the two coordinate spaces are oriented with respect to each other in world space, as this is determined by the rotation of the cone's parent, the cube.

What I don't know how to do is convert the values of the vector I want to add from one coordinate system to another.

Here is a series of illustrations that should hopefully make this clear.

The null (the circle with the arrows) is the parent of the cube.
The cube is the parent of the cone. Both the cube and the cone have been translated so that you can see them clearly. I moved some points on the cube so that it is easy to see it's orientation. This doesn't affect what I am trying to do.

http://animationmentee.com/resources/offsetTest/screencap1.gif
In the next step, I rotate the cube. The cone moves as one would expect it to as a child of the cube.

http://animationmentee.com/resources/offsetTest/screencap2.gif
Here, I've set the cube's neutral pose position in Y to equal -5. Because the SRT translation value for Y is still 0, the cube and cone move down. The cube is moving in the null's coordinate system, which happens to be lined up with world space.

Now I placed a yellow sphere where the cone used to be located. I want to move the cone using it's SRT translation values back to this position. I know that I want to move it in the opposite direction I moved the cube. In the null's coordinate space (which is where the cube moves, this is simply 5 units in Y.) But I can't just apply the value 5 units to the local translation values of the cone. That would send it 5 units in the direction in which the green manipulation arrow is pointing. I need to figure out what SRT translation values I need to add to the cone's current local translation values in order to move it back to where the sphere is located. I just don't know what the math for this is or how to implement it using XSI's scripting operators.

http://animationmentee.com/resources/offsetTest/screencap3.gif

Any solution to this problem would be earth shatteringly helpful for me. Thanks again everyone!

tredeger
02-28-2006, 06:13 PM
I've started a new thread in General Discussion in which I've abstracted out this problem to the mathematical level. The thread, for those interested can be found here:

Here is the content of my first post in that thread:

I often have great difficulty understanding different coordinate spaces in my 3D app. After much thinking, I've finally managed to take my current problem and abstract it out to a straightforward math problem.

Let's say I know the values of a vector in one coordinate space and have a second coordinate space that has been rotated relative to the first. I also know the value of the rotation.

How can I determine the values of the exact same vector in the second coordinate space? I've illustrated this with a 2D example, but I need a solution that will work in 3D.

http://animationmentee.com/resources/offsetTest/vectors.gif

Thanks to the math genius who can help me understand this problem.

cheers!

ThE_JacO
02-28-2006, 10:27 PM
from a setup point of view, I'm still struggling to understand WHY you'd be after something like this.
It still looks to me like all you want is to propagate position but not rotation, which means you should use a position constraint (from the cone to the cube) or, if you have to animate the cone, get another layer in the hierarchy, constrain that and parent the cone underneath.

as for the operation you are after, you'd need to transform the vector, after it's been transformer, by the inverse matrix of its parent, but again it would be just as pointless, as (and if you've even illustrated it) you should see by now that you seem to be after NOT changing the vector in first place.

tredeger
02-28-2006, 11:34 PM
from a setup point of view, I'm still struggling to understand WHY you'd be after something like this.
It still looks to me like all you want is to propagate position but not rotation, which means you should use a position constraint (from the cone to the cube) or, if you have to animate the cone, get another layer in the hierarchy, constrain that and parent the cone underneath.

as for the operation you are after, you'd need to transform the vector, after it's been transformer, by the inverse matrix of its parent, but again it would be just as pointless, as (and if you've even illustrated it) you should see by now that you seem to be after NOT changing the vector in first place.

Basically i'm trying to turn the cube into an animatable pivot point for the cone. I would reset the pivot location by changing the cube's neutral pose and translating the cone in the opposite direction to compensate and keep it in place. Then translating and rotating the cube is equivalent to rotating the cone from a pivot point whose position is the same as the cube center.

Why not just use the cool animatable pivot point in XSI?
Because I want to wire up the values to a control object that the user can position at will.

Why can't you wire the animatable pivot point parameters to the control object?
Well, I could wire up the pivot position values easily enough. But to make those work, you also have to set the correct position compensation values as well. I can't figure out how to get those correct values. When you do it all manually in the PPG, xsi automatically calculates the compensation when you change the pivot position values and you can then hit a button to key both with constant interpolation (which is necessary to make it work correctly). But I can't figure out how to wire that calculation into an expression and automate the whole thing.

So this is a work around to try to achieve that.

ThE_JacO
03-01-2006, 01:23 AM
in that case all you want is one more step in the hierarchy, and eventually turn child compensation on when you move the pivot, so that XSI will calculate such offset for you.

tredeger
03-01-2006, 02:29 AM
in that case all you want is one more step in the hierarchy, and eventually turn child compensation on when you move the pivot, so that XSI will calculate such offset for you.

You seem to be on to a simple and elegant solution. The only thing I'm having some difficulty with is the fact that when I turn on child compensation from the MCP using the button, it does not seem to work when I change values with the sliders in PPGs. It only seems to work when using the viewport manipulator gnomon. But I feel so close!

tredeger
03-01-2006, 06:09 AM
OK, i think i've got things the way I want them to work using child compensation BUT i'm a little confused as to whether this will actually work when i start animating with this setup. As I understand it, you can't have animation keys on the children for child compensation to work right? So does that mean child comp is actually only ever for positioning without actually animating that changing relationship? or is there a way to preserve those shifting changes? If there isn't, then the auto calculation of child compensation doesn't really help at all.

CGTalk Moderation
03-01-2006, 06:09 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.