Commit ed373887 authored by hybrid's avatar hybrid

Add value clipping to cope with precision.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@2612 dfc29bdd-3216-0410-991c-e03cc46cb475
parent 7d31e869
...@@ -25,11 +25,20 @@ void CSceneNodeAnimatorRotation::animateNode(ISceneNode* node, u32 timeMs) ...@@ -25,11 +25,20 @@ void CSceneNodeAnimatorRotation::animateNode(ISceneNode* node, u32 timeMs)
{ {
if (node) // thanks to warui for this fix if (node) // thanks to warui for this fix
{ {
u32 diffTime = timeMs - StartTime; const u32 diffTime = timeMs - StartTime;
if (diffTime != 0) if (diffTime != 0)
{ {
node->setRotation(node->getRotation() + Rotation*(diffTime*0.1f)); // clip the rotation to small values, to avoid
// precision problems with huge floats.
core::vector3df rot = node->getRotation() + Rotation*(diffTime*0.1f);
if (rot.X>360.f)
fmodf(rot.X, 360.f);
if (rot.Y>360.f)
fmodf(rot.Y, 360.f);
if (rot.Z>360.f)
fmodf(rot.Z, 360.f);
node->setRotation(rot);
StartTime=timeMs; StartTime=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