connel.reed Posted May 3, 2020 Share Posted May 3, 2020 Hello I'm fairly new to Unigine as I just started using it once the community version came out, I'm trying to switch animations on a ObjectMeshSkinned node and am finding issues with the animations starting at different frames when switched to, is there any way to make this consistent? <-- How animations are being set <-- How switching between animations is being handled Link to comment
honya Posted May 3, 2020 Share Posted May 3, 2020 Hi, frame for setFrame is compute usually: time += animationSpeed * Unigine::Game::getIFps(); when time you store it for use in next frame. And you multiply time with numFrames of animations, that don't make a sens. Link to comment
connel.reed Posted May 4, 2020 Author Share Posted May 4, 2020 (edited) Hi thanks for the quick response, float ifps = Game::getIFps(); if (!jumping && !walking && !running) { Object_m_s_p_body->setFrame(3, animTime); animTime += 24.0f * ifps; } So something like this should work or is there a way to get the animation speed? the animations still seem to not start at the beginning of their animation. Edit: Figured it out, I was forgetting to reset animTime to 0 when changing animations, if this is a bad Idea please do let me know though Edited May 4, 2020 by connel.reed Link to comment
honya Posted May 4, 2020 Share Posted May 4, 2020 That is correct to reset time for start play animation from the beginning. Link to comment
Recommended Posts