Revision: 1621
http://rigsofrods.svn.sourceforge.net/rigsofrods/?rev=1621&view=rev
Author: aperion
Date: 2011-01-31 09:11:25 +0000 (Mon, 31 Jan 2011)
Log Message:
-----------
fixed incorrect logic negation, and fixed some incorrect comparisons. This
worked before I updated to latest, unsure about latest because RoR crashes in
latest...
Modified Paths:
--------------
trunk/source/main/collisions.cpp
Modified: trunk/source/main/collisions.cpp
===================================================================
--- trunk/source/main/collisions.cpp 2011-01-31 03:34:20 UTC (rev 1620)
+++ trunk/source/main/collisions.cpp 2011-01-31 09:11:25 UTC (rev 1621)
@@ -283,40 +283,40 @@
}
Ogre::Vector3 Collisions::calcCollidedSide(const Ogre::Vector3& pos,
Ogre::Vector3& lo, Ogre::Vector3& hi)
-{
- float min = pos.z - lo.z;
- Ogre::Vector3 newPos = Ogre::Vector3(pos.x, pos.y, lo.z);
+{
+ Ogre::Real min = pos.x - lo.x;
+ Ogre::Vector3 newPos = Ogre::Vector3(lo.x, pos.y, pos.z);
- float t = pos.z - hi.z;
- if (t > min) {
- min = t;
- newPos = Ogre::Vector3(pos.x, pos.y, hi.z);
- };
-
- t = pos.x - lo.x;
+ Ogre::Real t = pos.y - lo.y;
if (t < min) {
- min = t;
- newPos = Ogre::Vector3(lo.x, pos.y, pos.z);
+ min=t;
+ newPos = Ogre::Vector3(pos.x, lo.y, pos.z);
};
- t = pos.y - lo.y;
+ t = pos.z - lo.z;
if (t < min) {
min=t;
- newPos = Ogre::Vector3(pos.x, lo.y, pos.z);
+ newPos = Ogre::Vector3(pos.x, pos.y, lo.z);
};
- t = pos.x - hi.x;
- if (t > min) {
+ t = hi.x - pos.x;
+ if (t < min) {
min=t;
newPos = Ogre::Vector3(hi.x, pos.y, pos.z);
};
- t = pos.y - hi.y;
- if (t > min) {
+ t = hi.y - pos.y;
+ if (t < min) {
min=t;
newPos = Ogre::Vector3(pos.x, hi.y, pos.z);
};
+ t = hi.z - pos.z;
+ if (t < min) {
+ min=t;
+ newPos = Ogre::Vector3(pos.x, pos.y, hi.z);
+ };
+
return newPos;
}
@@ -763,7 +763,7 @@
if ((*cell)[k] != (int)UNUSED_CELLELEMENT &&
(*cell)[k]<MAX_COLLISION_BOXES)
{
collision_box_t *cbox=&collision_boxes[(*cell)[k]];
- if (*refpos < cbox->lo || *refpos > cbox->hi) continue;
+ if( !( (*refpos) > cbox->lo && (*refpos) < cbox->hi ) )
continue;
if (cbox->refined || cbox->selfrotated)
{
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)!
Finally, a world-class log management solution at an even better price-free!
Download using promo code Free_Logger_4_Dev2Dev. Offer expires
February 28th, so secure your free ArcSight Logger TODAY!
http://p.sf.net/sfu/arcsight-sfd2d
_______________________________________________
Rigsofrods-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/rigsofrods-devel