[bug] mDerivedDirection not normalised

jmd

28-02-2009 20:50:51

mDerivedDirection is not normalised when using Portal::updateDerivedValues() with a portal of type PORTAL_TYPE_QUAD.
it's because of those lines (OgrePortal.cpp line 305):

transform.extract3x3Matrix(rotation);
mDerivedDirection = rotation * mDirection;

My transform matrix has a scale so it scales the mDerivedDirection vector.

This impacts the PCZSceneManager::connectPortalsToTargetZonesByLocation() method, because in OgrePCZZone.cpp line 90 you have:
portal2->getDerivedDirection().dotProduct(portal->getDerivedDirection()) < -0.9)
So if the derived direction is not normalised, the dotProduct might not return a < -0.9 value and the connectPortalsToTargetZonesByLocation() will fail to connect some portals and the program using PCZ will crash because you will have some portals with no targetZone.

My fix is to normalise mDerivedDirection after line 306 in OgrePortal.cpp.

Thank you,

JM

Chaster

11-03-2009 04:44:49

I'll put this on the todo list. Simple fix, but I'm quite busy nowadays and haven't been able to keep up with my duties for maintaining PCZSM. Apologies everyone..

Chaster