Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project!

## RE: [Algorithms] RE: Using animation keys from 3DSMax

 RE: [Algorithms] RE: Using animation keys from 3DSMax From: Peter Lipson - 2004-03-31 21:01:28 Attachments: Message as HTML ```you need to think through the whole system, and not just focus on each piece independently. If all you want is to take an animated hierarchy that's vertical in MAX but is now lying face-down in your system, just add a node at the root and apply 90' rotation on X. All the rest of the data (assuming the handedness is the same!) will work just fine, since it's all relative to the root. However, if you want or need to modify the local coordinate system of each object in the hierarchy, you need to account for that in the transforms between each node by applying the inverse of your mesh transforms. Writing it out algebraically can help a lot - it forces you to see where you're applying transforms and helps identify where any inconsistencies in your approach might be. Peter -----Original Message----- From: gdalgorithms-list-admin@... [mailto:gdalgorithms-list-admin@...]On Behalf Of Ryan Greene Sent: Wednesday, March 31, 2004 11:47 AM To: gdalgorithms-list@... Subject: [Algorithms] RE: Using animation keys from 3DSMax Okay, so my swap is incorrect... but that isn't the problem I'm dealing with. I can properly transform the mesh and skeleton, however since the rotation keys I'm getting are in Max's space I can't apply the rotations to the skeleton properly. It would seem that I would need to convert the quat from max's z-up space to my y-up space... however I am having difficulty doing that conversion. This is why I wanted to keep the mesh in max's z-up space, and then do the conversion when I build each bone's matrix (it's free). Swapping your Y and Z is not sufficient to change your coordinate system. And if you need to change handedness you have to do other things. Assuming your handedness is the same, you need to perform a clockwise 90 degree rotation about x. (or swap y and z and negate one of them.) For example, if your engine is the same handedness as MAX swap the y and the z and negate the Y. This works for me as the engine that I'm working on right now has the same handedness as MAX. swap =3D -y; y =3D z; z =3D swap; As a side note, are you doing the swizzle at run-time? If so why? Why not take care of this at export time, then you never have to worry about using MAX's coordinate system to calculate the parent matrices using your coordinate system. --Pete ```

 RE: [Algorithms] Using animation keys from 3DSMax From: Tyson Jensen - 2004-03-30 18:08:56 Attachments: Message as HTML ```Swapping columns or any other such procedure is likely to lead into difficult to find bugs. What you really want to do is define a coordinate transform (ie, a matrix) that transforms the Max coordinate system into your own. This transform should be applied to the root joint of the character. At that point, all child joints should come out in the correct system. Switching handedness can also be accomplished with a matrix, if required. =20 Transforming any joint into world space (essential if you don't want to go insane trying to debug CCD) is accomplished by simply applying the joint chain as you would to pose the character. Transforming back into joint space requires building that world space transform as its own matrix and inverting it. Transforming a chain back into local space is a bit tricky. I'm not going to try to provide a solution off the top of my head. Suffice it to say, it is worth looking up to make sure you have it right. To do IK, transform the interesting bones to world space, figure out the solution and then carefully get those transforms back into joint space. The main reason for working in world space is then you can use your debug draw utilities to draw everything you are doing. (If you have sufficiently clever debug drawing code, you can work in local space and let the debug drawing code transform to world space). =20 -----Original Message----- From: gdalgorithms-list-admin@... [mailto:gdalgorithms-list-admin@...] On Behalf Of Ryan Greene Sent: Monday, March 29, 2004 9:53 PM To: gdalgorithms-list@... Subject: [Algorithms] Using animation keys from 3DSMax =20 Apologies if this isn't the right place for this, I've tried a few online forums, including Discreet's Sparks website without much response. Here's my issue. =20 For the rotations on my animation keys I'm using the quats defined by Max. The only issue that I had to overcome with that was that my engine understands y to be up, whereas Max understands z to be up. This was easily solved by swapping columns 2 & 3 when I converted animation keys into matrices before sending to the skinning routine (thereby swapping the y/z axes -- effectively the animation engine works in "Max's space"). =20 Now that I'm trying to do some simple IK stuff, I'm having problems. Since all of the rotation keys that I use are considered to be in your parent's bone space, I need to calculate the rotation for a bone in Max's z-up quat space. I'm trying to do a simple CCD system, and I thought it would be sufficient to simply swizzle y/z of the axis of rotation when I build my quats, but that doesn't seem to be working -- I'm getting results that look just plain wrong. =20 Obviously I'm missing something obvious, can somebody help me out here? =20 Thanks, Ryan Greene ```
 [Algorithms] RE: Using animation keys from 3DSMax From: Ryan Greene - 2004-03-31 19:47:08 Attachments: Message as HTML ```Okay, so my swap is incorrect... but that isn't the problem I'm dealing = with. I can properly transform the mesh and skeleton, however since the = rotation keys I'm getting are in Max's space I can't apply the rotations = to the skeleton properly. It would seem that I would need to convert the = quat from max's z-up space to my y-up space... however I am having = difficulty doing that conversion. This is why I wanted to keep the mesh = in max's z-up space, and then do the conversion when I build each bone's = matrix (it's free). Swapping your Y and Z is not sufficient to change your coordinate = system. And if you need to change handedness you have to do other = things. Assuming your handedness is the same, you need to perform a = clockwise 90 degree rotation about x. (or swap y and z and negate one = of them.) For example, if your engine is the same handedness as MAX swap the y and = the z and negate the Y. This works for me as the engine that I'm = working on right now has the same handedness as MAX. swap =3D3D -y; y =3D3D z; z =3D3D swap; As a side note, are you doing the swizzle at run-time? If so why? Why = not take care of this at export time, then you never have to worry about = using MAX's coordinate system to calculate the parent matrices using = your coordinate system. --Pete ```
 RE: [Algorithms] RE: Using animation keys from 3DSMax From: Peter Lipson - 2004-03-31 21:01:28 Attachments: Message as HTML ```you need to think through the whole system, and not just focus on each piece independently. If all you want is to take an animated hierarchy that's vertical in MAX but is now lying face-down in your system, just add a node at the root and apply 90' rotation on X. All the rest of the data (assuming the handedness is the same!) will work just fine, since it's all relative to the root. However, if you want or need to modify the local coordinate system of each object in the hierarchy, you need to account for that in the transforms between each node by applying the inverse of your mesh transforms. Writing it out algebraically can help a lot - it forces you to see where you're applying transforms and helps identify where any inconsistencies in your approach might be. Peter -----Original Message----- From: gdalgorithms-list-admin@... [mailto:gdalgorithms-list-admin@...]On Behalf Of Ryan Greene Sent: Wednesday, March 31, 2004 11:47 AM To: gdalgorithms-list@... Subject: [Algorithms] RE: Using animation keys from 3DSMax Okay, so my swap is incorrect... but that isn't the problem I'm dealing with. I can properly transform the mesh and skeleton, however since the rotation keys I'm getting are in Max's space I can't apply the rotations to the skeleton properly. It would seem that I would need to convert the quat from max's z-up space to my y-up space... however I am having difficulty doing that conversion. This is why I wanted to keep the mesh in max's z-up space, and then do the conversion when I build each bone's matrix (it's free). Swapping your Y and Z is not sufficient to change your coordinate system. And if you need to change handedness you have to do other things. Assuming your handedness is the same, you need to perform a clockwise 90 degree rotation about x. (or swap y and z and negate one of them.) For example, if your engine is the same handedness as MAX swap the y and the z and negate the Y. This works for me as the engine that I'm working on right now has the same handedness as MAX. swap =3D -y; y =3D z; z =3D swap; As a side note, are you doing the swizzle at run-time? If so why? Why not take care of this at export time, then you never have to worry about using MAX's coordinate system to calculate the parent matrices using your coordinate system. --Pete ```
 Re: [Algorithms] RE: Using animation keys from 3DSMax From: jason zhang - 2004-04-01 01:49:41 Attachments: Message as HTML ```SWYgeW91IHdhbnQgdG8gY29udmVydCB0aGUgaGllcmFyY2h5IGZyb20gTWF4IHN5c3RlbSB0byBE M0Qgc3lzdGVtLCB5b3UgaGF2ZSB0byBoYW5kbGUgYm90aCB0aGUgdHJhbnNmb3JtIG1hdHJpeCBh bmQgbG9jYWwgY29vcmRzLg0KDQpBc3N1bWU6IFAxIGlzIHRoZSBjb29yZCBpbiBNYXggd29ybGQg c3BhY2UsIFAgaXMgdGhlIGxvY2FsIGNvb3JkcywgTTEsIE0yLi4uLk1uIGlzIHRoZSBtYXRyaXgg Zm9yIHRoZSBoaWVyYXJjaHk6ICANClRoZW46ICAgIFAxID0gTW4gKiBNbi0xICogLi4uLi4gTTEg KiBQDQoNCkFzc3VtZTogVCBpcyB0aGUgbWF0cml4IGNvbnZlcnRpbmcgTWF4IGNvb3JkIHRvIEQz RCBjb29yZC4oIGluY2x1ZGluZyByb3RhdGluZyBhbmQgbWlycm9yICkNCndlIG5lZWQgdGhlIHdv cmxkIHNwYWNlIGNvb3JkIGluIEQzRDogICBRMSA9IFQgKiBQMSA9IFQgKiBNbiAqIEludihUKSAq IFQgKiBNbi0xICogLi4uLi4uLi5UICogTTEgKiBJbnYoVCkgKiBUICogUDsNCg0Kc28gd2UgZ2V0 IHRoZSBoaWVyYXJjaHkgaW4gRDNEOiAgIFQqTW4qSW52KFQpLCAuLi4uLiBUKk0xKkludihUKSwg IFQqUDsNCg0KSmFzb24gWmhhbmcNCiAgLS0tLS0gT3JpZ2luYWwgTWVzc2FnZSAtLS0tLSANCiAg RnJvbTogUGV0ZXIgTGlwc29uIA0KICBUbzogZ2RhbGdvcml0aG1zLWxpc3RAbGlzdHMuc291cmNl Zm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HNvIHdoeT8g IFdoeSBub3QgdGFrZSBjYXJlIG9mIHRoaXMgYXQgZXhwb3J0IHRpbWUsIHRoZW4geW91IG5ldmVy IGhhdmUgdG8gd29ycnkgYWJvdXQgdXNpbmcgTUFYJ3MgY29vcmRpbmF0ZSBzeXN0ZW0gdG8gY2Fs Y3VsYXRlIHRoZSBwYXJlbnQgbWF0cmljZXMgdXNpbmcgeW91ciBjb29yZGluYXRlIHN5c3RlbS4N Cg0KICAgIC0tUGV0ZQ0KDQo= ```
 [Algorithms] RE: Using animation keys from 3DSMax From: Ryan Greene - 2004-04-05 21:11:02 Attachments: Message as HTML ```I'm trying to do everything in world-space. I think I have the correct = approach, however my issue is that all my quats in my animations are = built by max and are stored as if we were still in max -- that is to say = z is up. As a result, any quat that I come up with for my IK will be in = the incorrect space (y is up). I'm obviously missing something very = basic, or not communicating something very basic. The responses that = I've gotten from here so far largely have been something to the effect = of how to transform points or the whole character, however that isn't my = issue. I need to figure out how to transform the per-bone rotation. = Since all bones have their rotations stored in respect to their parent = bone, it is insufficent to simply rotate the root bone to get the = character pointed the right way -- data wise all the rotations are still = done considering that z is up. Therefore, any rotation that I come up = with in my IK solvers will incorrect if I try to apply it to a bone in = the skeleton. What it seems like I need is a way to convert a quat from = max into a quat that I am able to work with in my engine. Does this make = sense? I'm obviously missing something simple... Swapping columns or any other such procedure is likely to lead into difficult to find bugs. What you really want to do is define a coordinate transform (ie, a matrix) that transforms the Max coordinate system into your own. This transform should be applied to the root joint of the character. At that point, all child joints should come = out in the correct system. Switching handedness can also be accomplished with a matrix, if required. =20 =20 =20 Transforming any joint into world space (essential if you don't want to go insane trying to debug CCD) is accomplished by simply applying the joint chain as you would to pose the character. Transforming back into joint space requires building that world space transform as its own matrix and inverting it. Transforming a chain back into local space is a bit tricky. I'm not going to try to provide a solution off the top = of my head. Suffice it to say, it is worth looking up to make sure you have it right. To do IK, transform the interesting bones to world space, figure out the solution and then carefully get those transforms back into joint space. The main reason for working in world space is then you can use your debug draw utilities to draw everything you are doing. (If you have sufficiently clever debug drawing code, you can work in local space and let the debug drawing code transform to world space). =20 =20 =20 -----Original Message----- From: gdalgorithms-list-admin@... [mailto:gdalgorithms-list-admin@...] On Behalf Of Ryan Greene Sent: Monday, March 29, 2004 9:53 PM To: gdalgorithms-list@... Subject: [Algorithms] Using animation keys from 3DSMax =20 =20 =20 Apologies if this isn't the right place for this, I've tried a few online forums, including Discreet's Sparks website without much response. Here's my issue. =20 =20 =20 For the rotations on my animation keys I'm using the quats defined by Max. The only issue that I had to overcome with that was that my engine understands y to be up, whereas Max understands z to be up. This was easily solved by swapping columns 2 & 3 when I converted animation keys into matrices before sending to the skinning routine (thereby swapping the y/z axes -- effectively the animation engine works in "Max's space"). =20 =20 =20 Now that I'm trying to do some simple IK stuff, I'm having problems. Since all of the rotation keys that I use are considered to be in your parent's bone space, I need to calculate the rotation for a bone in Max's z-up quat space. I'm trying to do a simple CCD system, and I thought it would be sufficient to simply swizzle y/z of the axis of rotation when I build my quats, but that doesn't seem to be working -- I'm getting results that look just plain wrong. =20 =20 =20 Obviously I'm missing something obvious, can somebody help me out here? =20 =20 =20 Thanks, =20 Ryan Greene ```
 Re: [Algorithms] RE: Using animation keys from 3DSMax From: Ron Hay - 2004-04-07 18:37:19 ```I feel your pain - I suffered through this a couple of years ago (from 3DSMax 3.1) - here's the function I came up with for "fixing" the transforms to what I wanted. It worked, although I don't output quats, I output 4x4 matrices per bone. Let me know if you need more email (contact by private email if you want). Good luck! // ============================================================================ // FixCoordSys(Matrix3 &tm) - Similarity Transformation // similarity transformation consists of swapping the 2nd and 3rd rows, then // swapping the the 2nd and 3rd columns as above, and THEN negating all // the elements of the 1st row, then negating all the elements of the 1st // column (with the result that the 11 element is unchanged). // ---------------------------------------------------------------------------- void FixCoordSys(Matrix3 &tm) { // swap 2nd and 3rd rows Point3 row = tm.GetRow(1); tm.SetRow(1, tm.GetRow(2)); tm.SetRow(2, row); // swap 2nd and 3rd columns Point4 column = tm.GetColumn(1); tm.SetColumn(1, tm.GetColumn(2)); tm.SetColumn(2, column); // negate 1rst row and column tm.SetRow(0, -(tm.GetRow(0))); tm.SetColumn(0, -(tm.GetColumn(0))); } Ryan Greene wrote: > I'm trying to do everything in world-space. I think I have the correct > approach, however my issue is that all my quats in my animations are > built by max and are stored as if we were still in max -- that is to > say z is up. As a result, any quat that I come up with for my IK will > be in the incorrect space (y is up). I'm obviously missing something > very basic, or not communicating something very basic. The responses > that I've gotten from here so far largely have been something to the > effect of how to transform points or the whole character, however that > isn't my issue. I need to figure out how to transform the per-bone > rotation. Since all bones have their rotations stored in respect to > their parent bone, it is insufficent to simply rotate the root bone to > get the character pointed the right way -- data wise all the rotations > are still done considering that z is up. Therefore, any rotation that > I come up with in my IK solvers will incorrect if I try to apply it to > a bone in the skeleton. What it seems like I need is a way to convert > a quat from max into a quat that I am able to work with in my engine. > Does this make sense? I'm obviously missing something simple... > > > > > > Swapping columns or any other such procedure is likely to lead into > difficult to find bugs. What you really want to do is define a > coordinate transform (ie, a matrix) that transforms the Max coordinate > system into your own. This transform should be applied to the root > joint of the character. At that point, all child joints should come out > in the correct system. Switching handedness can also be accomplished > with a matrix, if required. > > > > Transforming any joint into world space (essential if you don't want to > go insane trying to debug CCD) is accomplished by simply applying the > joint chain as you would to pose the character. Transforming back into > joint space requires building that world space transform as its own > matrix and inverting it. Transforming a chain back into local space is > a bit tricky. I'm not going to try to provide a solution off the top of > my head. Suffice it to say, it is worth looking up to make sure you > have it right. To do IK, transform the interesting bones to world > space, figure out the solution and then carefully get those transforms > back into joint space. The main reason for working in world space is > then you can use your debug draw utilities to draw everything you are > doing. (If you have sufficiently clever debug drawing code, you can > work in local space and let the debug drawing code transform to world > space). > > > > -----Original Message----- > From: gdalgorithms-list-admin@... > [mailto:gdalgorithms-list-admin@...] On Behalf Of Ryan > Greene > Sent: Monday, March 29, 2004 9:53 PM > To: gdalgorithms-list@... > Subject: [Algorithms] Using animation keys from 3DSMax > > > > Apologies if this isn't the right place for this, I've tried a few > online forums, including Discreet's Sparks website without much > response. Here's my issue. > > > > For the rotations on my animation keys I'm using the quats defined by > Max. The only issue that I had to overcome with that was that my engine > understands y to be up, whereas Max understands z to be up. This was > easily solved by swapping columns 2 & 3 when I converted animation keys > into matrices before sending to the skinning routine (thereby swapping > the y/z axes -- effectively the animation engine works in "Max's > space"). > > > > Now that I'm trying to do some simple IK stuff, I'm having problems. > Since all of the rotation keys that I use are considered to be in your > parent's bone space, I need to calculate the rotation for a bone in > Max's z-up quat space. I'm trying to do a simple CCD system, and I > thought it would be sufficient to simply swizzle y/z of the axis of > rotation when I build my quats, but that doesn't seem to be working -- > I'm getting results that look just plain wrong. > > > > Obviously I'm missing something obvious, can somebody help me out here? > > > > Thanks, > > Ryan Greene > ```
 RE: [Algorithms] RE: Using animation keys from 3DSMax From: Pete Brubaker - 2004-04-07 18:52:25 ```I feel your pain too man. So what everyone has been telling you will work. You should just create = a rotation quat/matrix that will rotate everything from MAX's coordinate system to yours. If you want to do it with a quat, just create a quat = that rotates everything -90, or +90 ( don't really remember which right now ) around the X axis and multiply it by all of the quats (keys) in each = track. If you then transform the geometry everything will be in your Y up coordinate system. But do this off-line as it'll save you having to add = a root joint. Alternatively you could work in MAX's coordinate system, or a Z-Up coordinate system in the animation, then add a root transform to rotate = it 90 or -90 degrees around the X. It all depends which coordinate system = you want to use when you write your animation engine. Does that make sense? --Pete -----Original Message----- From: Ron Hay [mailto:rhay@...]=20 Sent: Wednesday, April 07, 2004 11:40 AM To: gdalgorithms-list@... Subject: Re: [Algorithms] RE: Using animation keys from 3DSMax I feel your pain - I suffered through this a couple of years ago (from=20 3DSMax 3.1) - here's the function I came up with for "fixing" the=20 transforms to what I wanted. It worked, although I don't output quats,=20 I output 4x4 matrices per bone. Let me know if you need more email=20 (contact by private email if you want). Good luck! //=20 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D // FixCoordSys(Matrix3 &tm) - Similarity Transformation // similarity transformation consists of swapping the 2nd and 3rd rows, = then // swapping the the 2nd and 3rd columns as above, and THEN negating all // the elements of the 1st row, then negating all the elements of the = 1st // column (with the result that the 11 element is unchanged). //=20 -------------------------------------------------------------------------= --- void FixCoordSys(Matrix3 &tm) { // swap 2nd and 3rd rows Point3 row =3D tm.GetRow(1); tm.SetRow(1, tm.GetRow(2)); tm.SetRow(2, row); // swap 2nd and 3rd columns Point4 column =3D tm.GetColumn(1); tm.SetColumn(1, tm.GetColumn(2)); tm.SetColumn(2, column); // negate 1rst row and column tm.SetRow(0, -(tm.GetRow(0))); tm.SetColumn(0, -(tm.GetColumn(0))); } Ryan Greene wrote: > I'm trying to do everything in world-space. I think I have the correct = > approach, however my issue is that all my quats in my animations are=20 > built by max and are stored as if we were still in max -- that is to=20 > say z is up. As a result, any quat that I come up with for my IK will=20 > be in the incorrect space (y is up). I'm obviously missing something=20 > very basic, or not communicating something very basic. The responses=20 > that I've gotten from here so far largely have been something to the=20 > effect of how to transform points or the whole character, however that = > isn't my issue. I need to figure out how to transform the per-bone=20 > rotation. Since all bones have their rotations stored in respect to=20 > their parent bone, it is insufficent to simply rotate the root bone to = > get the character pointed the right way -- data wise all the rotations = > are still done considering that z is up. Therefore, any rotation that=20 > I come up with in my IK solvers will incorrect if I try to apply it to = > a bone in the skeleton. What it seems like I need is a way to convert=20 > a quat from max into a quat that I am able to work with in my engine.=20 > Does this make sense? I'm obviously missing something simple... > =20 > =20 > =20 > =20 > =20 > Swapping columns or any other such procedure is likely to lead into > difficult to find bugs. What you really want to do is define a > coordinate transform (ie, a matrix) that transforms the Max coordinate > system into your own. This transform should be applied to the root > joint of the character. At that point, all child joints should come = out > in the correct system. Switching handedness can also be accomplished > with a matrix, if required. > > =20 > > Transforming any joint into world space (essential if you don't want = to > go insane trying to debug CCD) is accomplished by simply applying the > joint chain as you would to pose the character. Transforming back = into > joint space requires building that world space transform as its own > matrix and inverting it. Transforming a chain back into local space = is > a bit tricky. I'm not going to try to provide a solution off the top = of > my head. Suffice it to say, it is worth looking up to make sure you > have it right. To do IK, transform the interesting bones to world > space, figure out the solution and then carefully get those transforms > back into joint space. The main reason for working in world space is > then you can use your debug draw utilities to draw everything you are > doing. (If you have sufficiently clever debug drawing code, you can > work in local space and let the debug drawing code transform to world > space). > > =20 > > -----Original Message----- > From: gdalgorithms-list-admin@... > [mailto:gdalgorithms-list-admin@...] On Behalf Of Ryan > Greene > Sent: Monday, March 29, 2004 9:53 PM > To: gdalgorithms-list@... > Subject: [Algorithms] Using animation keys from 3DSMax > > =20 > > Apologies if this isn't the right place for this, I've tried a few > online forums, including Discreet's Sparks website without much > response. Here's my issue. > > =20 > > For the rotations on my animation keys I'm using the quats defined by > Max. The only issue that I had to overcome with that was that my = engine > understands y to be up, whereas Max understands z to be up. This was > easily solved by swapping columns 2 & 3 when I converted animation = keys > into matrices before sending to the skinning routine (thereby swapping > the y/z axes -- effectively the animation engine works in "Max's > space"). > > =20 > > Now that I'm trying to do some simple IK stuff, I'm having problems. > Since all of the rotation keys that I use are considered to be in your > parent's bone space, I need to calculate the rotation for a bone in > Max's z-up quat space. I'm trying to do a simple CCD system, and I > thought it would be sufficient to simply swizzle y/z of the axis of > rotation when I build my quats, but that doesn't seem to be working -- > I'm getting results that look just plain wrong. > > =20 > > Obviously I'm missing something obvious, can somebody help me out = here? > > =20 > > Thanks, > > Ryan Greene > =20 ------------------------------------------------------- This SF.Net email is sponsored by: IBM Linux Tutorials Free Linux tutorial presented by Daniel Robbins, President and CEO of GenToo technologies. Learn everything from fundamentals to system administration.http://ads.osdn.com/?ad_id=3D1470&alloc_id=3D3638&op=3Dcli= ck _______________________________________________ GDAlgorithms-list mailing list GDAlgorithms-list@... https://lists.sourceforge.net/lists/listinfo/gdalgorithms-list Archives: http://sourceforge.net/mailarchive/forum.php?forum_id=3D6188 ```
 [Algorithms] RE: Using animation keys from 3DSMax From: Ryan Greene - 2004-04-08 04:35:21 Attachments: Message as HTML ```Well, I found a solution that works for me. Thanks to all that have = offered help, in my zeal to find a way that would work with _MY_ 3d = coordinate space, I overlooked the simple and obvious solution: do all = my IK in MAX's space... As I do all my IK computations I just have to be = careful to make sure I use z-up space, and everything works out okay... = (duh).```