[Closed] get position of the obj at keys or keytime
Hi there
can anyone help me with this .
I like to collect the position of an object in all its keys or keytimes
I found this sniff belongs to Denis it collects all keytime of an objects
fn collectKeyTimes controller sorted:on = if isController controller and numKeys controller > -1 do
(
if sorted do sortKeys controller
for k in controller.keys collect k.time.frame
)
keyPos = collectKeyTimes $.pos.controller --#(0.0, 50.0, 100.0)
and to collect the position of object at these keys I do
Allpos = for i =1 to keyPos.count collect ( at time keyPos[i] $.pos )
but the problem is when i use this into a script controller ( of another object ) the scene become very slow and even i can’t edit the objet’s keys.
is there any better way.
any help is so appreciated
your question is more about how to use key data in a controller then how to get this data.
it would be more helpful if you tell us and show what you do in your controller
Thanks Denis for the reply
Definitely there is no problem with your code your code is short and fast as always, maybe the way that i use this script is so wrong.
Actually what i need is the position of an objects at (its) each keys, then put the key’s position into an array and …
For example I have a NGon which is a main cnt and it has some position animation with some keys.
I have a teapot which has a position script in its position controller. and i use above script into the teapot’s position script controller this way
By your script i collect all NGon’s keys then by second part i collect the position of NGon at each key as an array and use the array later for ex Allpos[1]
But the scene become so heavy even i can’t move the NGon’s keys at time bar