一名热爱体感技术的
业余专业开发人员

Ogre出现"...The minimum corner of the box must be less than or equal to maximum corner"错误

不知不觉用了半年Ogre3D了,开发过程中各种艰难曲折啊。其中有一个bug伴随我也快半年了,今天终于解决掉了,下面是bug解释:

怎么调试也不明白原因,即使google也没发现解决方法。原来自己不小心除以了一个0(在一定情况下),╮(╯▽╰)╭,大家写程序时一定要小心!!!!!

同时本人下来要转到Unity3D平台,打算放弃Ogre了~

下面是官网描述  http://www.ogre3d.org/forums/viewtopic.php?f=5&t=70549

– OgreAxisAlignedBox.h:252 – OGRE CRASHES

回答者建议:

99% of the time this is caused by the user passing in bad values to ogre’s methods that transform scene nodes. If you give ogre a NAN (Not A Number, a floating point value made by doing bad things like dividing by zero) when moving, rotating or scaling a scene node, it will corrupt the transform matrix the node generates. This is then used to transform the bounding box, which now has NANs in it and triggers the exception.

The most common causes are:
– dividing by zero
– calling acos or asin with a number bigger than 1.0 or less than -1.0 (even a fraction outside that range is fatal. 1.0000001 will cause NANs)

The acos/asin stuff can be fixed by calling Ogre’s Math::ACos or Math::ASin instead, they protect against bad values.

Often acos is used with rotations. For example, you might normalise two vectors, get their dot product, then get the acos of that. The answer is the angle between them. That can be used to rotate an object to look at something. The dot product of two normalised vectors is theoretically between -1.0 and 1.0, but due to floating point errors if might be bigger or smaller by enough to break the acos, which then breaks the rotation, which then breaks the bounding box.

赞(1)
转载请附上原文链接 (^ ^)延陵明天 » Ogre出现"...The minimum corner of the box must be less than or equal to maximum corner"错误

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址