View Full Version : how can I know if an object has moved?
03-23-2003, 04:20 AM
I want use a expression to get data of a object's movement at current frame----to know if the object has been moved. someone could help me?:airguitar
03-23-2003, 04:48 AM
compare its position at the current frame to its position at the previous frame.
03-23-2003, 07:40 AM
Thanks:)but,there is still a problem----how to get the object's position at the previous frame?in another words,how to keep the previous position to compare with the current position?
03-23-2003, 04:27 PM
I've got it.
03-23-2003, 09:10 PM
You can query the value at previous frame like this:
float $oldXpos = `getAttr -t (frame -1) objectName.tx`;
Or to speed up maya you could also create a frameCache node.
03-24-2003, 05:30 AM
thank u Alex,I will try it.
03-26-2003, 03:14 AM
Unfortunately, a getAttr like that won't really tell you whether something has moved if it's moving as a result of a parent's motion.
The xform command can be used with the -ws option to give you an object's position in world space, and you can stuff the result into a global variable on a frame-by-frame basis. You may also be able to do a getAttr -t on the world space matrix and compare the elements to see whether the object has moved.
03-26-2003, 04:46 AM
thank u mark,you made me knew more about it.
01-14-2006, 05:00 PM
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.
vBulletin v3.0.5, Copyright ©2000-2014, Jelsoft Enterprises Ltd.