AnimationMixerLayer.getTime ()
Hello everyone, I ran into a problem: there is a class AnimationMixerLayer, there is a getTime () method. When I want to capture the moment in the animation and use getTime (), it stops playing animation at all. I tried to display the animation time, it shows that the animation is playing, but nothing is visible on the screen.
Hi Артём,
Do you mean that the animation stops playing when you call `getTime()` on AnimationMixerLayer? I'm not seeing that behavior, I tried this script and when I tap it prints out the time correctly without stopping the animation.
Can you describe a little more what isn't working for you, or post the code you're using?
Hello. I also ran into a problem. getTime method and getDeltaTime always return 0. I think ts has issues because of that. I cas show my code (just 3 lines):
// @input float speed = 1.0 {"widget": "slider", "min": 0, "max": 10.0, "step": 0.01}
var newX = getTime() * script.speed);
print(getTime());
script.getSceneObject().getTransform().setLocalRotation(new quat(0, newX, 0, 0));
Because getTime is zero always, i got everything else zero and no updating. What am i doing wrong? Mabe getTime didn't work in editor at all? Just in app? can't understand
Hi Dan,
Are you running this script in the Update event? Otherwise, it will just run once on the first frame, where time really does equal 0. Check if the time is printing out every frame or just once at start.
Also, maybe this is just a typo from copying, but there is an extra ")" at the end of your second line. That could also lead to problems if the syntax isn't valid.
Let me know if you need more help with this!
Jacob