Maya for 3D Printing - Rapid Prototyping
In this course we're going to look at something a little different, creating technically accurate 3D printed parts.
# 1 10-01-2010 , 02:21 PM
Registered User
Join Date: Jan 2010
Location: UK & Norway
Posts: 4

Maya Expression - Value of Object Attribute at specific frame

Hi!
To get the value of an objects attribute at the CURRENT time is just to write:

ObjectName.AttributeName

But what if I want to get the value of the objects attribute at a SPECIFIC time?
Would be grateful for a fast reply, cheers!

# 2 10-01-2010 , 06:46 PM
NextDesign's Avatar
Technical Director
Join Date: Feb 2004
Posts: 2,988
Nasty little hack-together:

// set below
//===================
$object = "polySphere1";
$attribute = "radius";
$getAtTime = 24;

// don't touch below
//===================
$oldTime = `currentTime -q`;

currentTime $getAtTime;

$value = `getAttr ($object + "." + $attribute)`;

currentTime $oldTime;

// do something with the result
print $value;


Imagination is more important than knowledge.
# 3 10-01-2010 , 09:40 PM
Registered User
Join Date: Jan 2010
Location: UK & Norway
Posts: 4
THANK YOU SO MUCH! user added image
That was exactly what i needed! Was going nuts because I couldn't find a way to do that. I was sure it was an easier way to do it, but this method works great!

Basically now I've made a script with make my characters feet move correctly according to the ground. So I animate him to walk on the spot, and the scripts moves him correctly on the ground according to the movement of his feet.

I'm very new to Maya, and this is my first real project (making a dance), and this will make my life a lot easier!

user added image
Cheers man!

# 4 11-01-2010 , 02:47 AM
NextDesign's Avatar
Technical Director
Join Date: Feb 2004
Posts: 2,988
No problem mate. Glad to help out.


Imagination is more important than knowledge.
# 5 11-01-2010 , 08:42 AM
bendingiscool's Avatar
Subscriber
Join Date: Jul 2006
Location: London
Posts: 567
Hey there,

As you are new to all this it's probably not so important, but if you want to get realistic motion, you are going to have to think about getting the feet not to slide along the floor.

Unless you have already accounted for that in some way?

cheers,
Chris

# 6 11-01-2010 , 06:25 PM
Registered User
Join Date: Jan 2010
Location: UK & Norway
Posts: 4
@ bendingiscool
Hi, that is the basic idea behind the script. As I had problems with the characters feet sliding on the ground. So the script calulates how the character would move around according to the animation of the feet. If that makes sense... or just look at this crap example I put together in 5 min: LINK

# 7 11-01-2010 , 07:40 PM
NextDesign's Avatar
Technical Director
Join Date: Feb 2004
Posts: 2,988
You usually always want to animate the center of gravity by hand, as this is where a lot of the illusion of weight comes from.

In your case, you need to animate the root translation node, as well as the center of gravity to create a good look.

You application of the script looks cool though! You just need to find a way to be able to create some animation on top of the generated animation. Perhaps by having a locator, parented to another. The script run on the child, and you animation the parent. You then parent constrain the child locator to the center of gravity.

See if that works.


Imagination is more important than knowledge.

Last edited by NextDesign; 11-01-2010 at 07:45 PM.
# 8 11-01-2010 , 07:58 PM
Registered User
Join Date: Jan 2010
Location: UK & Norway
Posts: 4
Thanks for the tips NextDesign!
I really see what you mean, and I've been thinking about it. Because it's hard to make it look natural doing animation with math. It's smart to have manual controle over everything so the script don't overrun natural motion. I'll try the method you mentioned, was a good idea.

Thanks once again! =)

Posting Rules Forum Rules
You may not post new threads | You may not post replies | You may not post attachments | You may not edit your posts | BB code is On | Smilies are On | [IMG] code is On | HTML code is Off

Similar Threads