Commit c527d9ec authored by hybrid's avatar hybrid

Fix by Auria for starting the animated meshes only at first OnAnimate instead...

Fix by Auria for starting the animated meshes only at first OnAnimate instead of at random times and animation frames.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@4206 dfc29bdd-3216-0410-991c-e03cc46cb475
parent 5feef493
......@@ -81,6 +81,7 @@ f32 CAnimatedMeshSceneNode::getFrameNr() const
}
//! Get CurrentFrameNr and update transiting settings
void CAnimatedMeshSceneNode::buildFrameNr(u32 timeMs)
{
if (Transiting!=0.f)
......@@ -238,18 +239,27 @@ IMesh * CAnimatedMeshSceneNode::getMeshForCurrentFrame()
//! OnAnimate() is called just before rendering the whole scene.
void CAnimatedMeshSceneNode::OnAnimate(u32 timeMs)
{
buildFrameNr(timeMs-LastTimeMs);
if (Mesh)
// set CurrentFrameNr and update bbox
if (LastTimeMs==0)
{
CurrentFrameNr = (f32)StartFrame;
// bbox is the default one, so no change
}
else
{
scene::IMesh * mesh = getMeshForCurrentFrame();
buildFrameNr(timeMs-LastTimeMs);
if (mesh)
Box = mesh->getBoundingBox();
if (Mesh)
{
scene::IMesh * mesh = getMeshForCurrentFrame();
if (mesh)
Box = mesh->getBoundingBox();
}
}
LastTimeMs = timeMs;
IAnimatedMeshSceneNode::OnAnimate ( timeMs );
IAnimatedMeshSceneNode::OnAnimate(timeMs);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment