[SOLVED] Distorted objects after a while

A place for users of OGRE to discuss ideas and experiences of utilitising OGRE in their games / demos / applications.
poppu
Halfling
Posts: 48
Joined: Wed Mar 01, 2006 10:37 am

[SOLVED] Distorted objects after a while

Post by poppu »

Hello,

When i change the orientation of a entity with either Quaternion::Slerp or SceneNode::rotate(Vector3 axis, Radian angle), they become distorted a bit after a while.

Apparently this problem is due that the finale orientation after the change is not quiet normalize (i suppose the cause is the float numbers).

I resolve the pb with adding a a normalization of the Quaternion after the change of the orientation. But for lots of my entities i do a rotation each frame. So that takes a lot of ressources.

Does anybody have a clue about how to resolve this in a better way ?
Last edited by poppu on Thu Jul 13, 2006 10:12 am, edited 1 time in total.
User avatar
Kencho
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 4011
Joined: Fri Sep 19, 2003 6:28 pm
Location: Burgos, Spain
x 2

Post by Kencho »

Might THIS help?
Image
poppu
Halfling
Posts: 48
Joined: Wed Mar 01, 2006 10:37 am

Post by poppu »

I suppose i have to use another way to rotate my entities by X degrees each frames rather than using SceneNode::rotate(axis,angle).

It's strange because this problem starts to appear after about 6 hours of rotating. And i just rotate the entity with the function SceneNode::yaw(Angle) and i do nothing to the camera.

Your link doesn't help me but thanx anyway to try to find.
User avatar
Project5
Goblin
Posts: 245
Joined: Mon Nov 22, 2004 11:56 pm
Location: New York, NY, USA

Post by Project5 »

Without seeing any code, I can only guess, but here goes :-) Over time, floating point error would make your object's rotation matrix / quaternion become no longer normalized. Quats last longer than rotation matrices in this regard, but six hours may be the limit depending on what you're doing.

Just normalize them every now and again (once an hour or so?)

--Ben
poppu
Halfling
Posts: 48
Joined: Wed Mar 01, 2006 10:37 am

Post by poppu »

Your right,

I ll do Quaternion normalization at a every now as you said one hour or perhaps more.

Thanx