Jump to content

Switching between Animations on a single mesh


photo

Recommended Posts

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? 

 

image.png.9a4dd74930416a51f0a4875cb53d2a16.png <-- How animations are being set

 

image.png.f9e23e405d45459a534d2c81bb16713a.png<-- How switching between animations is being handled

 

 

Link to comment

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

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 by connel.reed
Link to comment
×
×
  • Create New...