Wednesday 2 March 2016

Recording Mouse Movements - Animation in Maya

If you're familiar with Adobe After Effects, you may also be familiar with something called 'Motion Sketch'. It's a pretty awesome function that lets you animate certain objects in real time just by using your mouse... kind of like puppetry.

Well guess what! I was looking for a feature like this the other day because I was working on a project where we were animating puppets in 3D! (you can view the finished product here:
https://vimeo.com/139854713)

Turns out, it's another secret bloody function in Maya! Good job Autodesk, keep us guessing.
Anyway, select an object to record and run this MEL script:


recordAttr -at "translate";
play - rec;

For rotations, unfortunately it's not as simple as changing the word 'translate' to rotate. You have to convert the data from degrees, to radians and then back to degrees again. Bit of a faff, but here's the necessary code:

string $curAngleUnits = `currentUnit -q -a`;
currentUnit -a rad; // Temporary set to radians 
recordAttr -at "rotateX" -at "rotateY" -at "rotateZ";
play -record; 
currentUnit -a ($curAngleUnits);

Hey presto, real-time, on-screen recording.




5 comments:

  1. hello Alex, can we get software script that might be use in Maya.
    for example we have the follwoing software
    Ghost Mouse Auto Clicker ?

    ReplyDelete
    Replies
    1. Hi Joy,

      A little confused as to what you mean - are you able to get the script working inside Maya? Let me know if not.

      Delete
  2. This comment has been removed by the author.

    ReplyDelete
  3. Hi, thanks for the scripts. I just need help - it's recording nicely, but if you are recording various object in the scene, sometimes it will delete animation of ather objects (non selected) why? Please help :(

    ReplyDelete
  4. Hey Jakub, can you provide a download link to your scene? Maybe I can take a look. Are you recording translate, rotate or both?

    ReplyDelete