View Full Version : 'move -rpr' using the API


Matte
03 March 2008, 09:23 PM
Hey

Does anyone know how to achieve the same the same result as with using the 'move -rpr' command via the API? Started using the API a while back and iam at the moment trying write myself a kinda of "Library", if you will, with things i normally do in melscripts. As to complement to the scriptingfunctionallity, you never know when such things might be good have. Most things i have figured out just fine, but the above i can quite seem to wrap my head aroud. In this case iam trying to just write a simple function that takes and object / MPoint / MVector / floats / double, or whatever, havnt decided yet, and just moves that object to that location using the same method as 'move -rpr' command would.

Only been using the the API for a couple of months so, iam still quite new to it. Its probably not that complicated, but any help would be appreciated. Anyone?

/Matte

Matte
03 March 2008, 11:15 AM
No one? Ok, an alternative way of asking the question maybe.

What i to be able to do really is a way of moving an object to a world space location without having to bother about how it has been previously transformed. Lets say that an object has 3 parents, all these objects have been frozen/moved/rotated in x y z completely arbitrary. What i want to be able to do is to run a command to just say that i want an object that is at the far end of this hiearchy to be at position 2 2 2, or something else, and just have the object move to this scene coordinate position.

This would probably include some matrix mathematics to achieve, and i have found some info regarding converting between coordinate spaces, but nothing i have found so far has helped me in better understanding on how to attack this.

Anyone know of any good webpages which one can read to get a better crasp of what need to be done to solve this?

/Matte

Diamant
03 March 2008, 03:14 AM
try looking into MFnTransform.. that is where you do all your transformations in the api.. or you can just call the move mel command from the api if its easier.

Matte
03 March 2008, 06:43 PM
Diamant: Working with the MfnTransform class is not really the problem as i have already experimented much with the members within. And so far i havnt found a single/combination member functiallity that does this. So i get the feeling that the rpr argument in the move command is a compound that does a lot of things to achieve its behavior. Its this behavior that eludes me, so i was hoping that someone that understands the mathematics behind all this could point me in the right direction. Anyone from alias/autodesk here who actually wrote the command, hehe? :)

/Matte

Diamant
03 March 2008, 09:23 PM
-Edit
so I actually was a little confused as to what move -rpr does.. after tinkering.. its really no different then an absolute movement of an object except its based off of the rotation pivot.. in that case.. again, you use MFnTransform.

get the rotation pivot.. then move the object to zero based off of the rotation pivot, then move it however much you want to move it and you will have the same effect as -rpr.. all within MFnTransform.

-Rich

Matte
03 March 2008, 10:58 AM
Aha, given that seemingly simple piece of advice i figured out how to solve it. I thank thee for zee input. :)

/Matte

CGTalk Moderation
03 March 2008, 10:58 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.


1