[Orxonox-commit 3594] r8279 - code/branches/spaceboundaries/src/orxonox/worldentities

kmaurus at orxonox.net kmaurus at orxonox.net
Thu Apr 21 14:17:39 CEST 2011


Author: kmaurus
Date: 2011-04-21 14:17:39 +0200 (Thu, 21 Apr 2011)
New Revision: 8279

Modified:
   code/branches/spaceboundaries/src/orxonox/worldentities/SpaceBoundaries.cc
Log:
Reflectin improved

Modified: code/branches/spaceboundaries/src/orxonox/worldentities/SpaceBoundaries.cc
===================================================================
--- code/branches/spaceboundaries/src/orxonox/worldentities/SpaceBoundaries.cc	2011-04-21 11:03:40 UTC (rev 8278)
+++ code/branches/spaceboundaries/src/orxonox/worldentities/SpaceBoundaries.cc	2011-04-21 12:17:39 UTC (rev 8279)
@@ -221,6 +221,8 @@
         Vector3 normal = item->getPosition() - this->getPosition();
         if( item->getVelocity().dotProduct(normal) > 0 ) // greife nur ein, falls 
         {
+            float dampingFactor = 0.5;
+        
             normal.normalise();
             Vector3 velocity = item->getVelocity();
             velocity = velocity.reflect(normal);
@@ -228,11 +230,20 @@
             acceleration = acceleration.reflect(normal);
             /*
             Vector3 rotationAxis = velocity.crossProduct(normal);
-            Ogre::Radian angle = velocity.angleBetween(normal);
+            Ogre::Radian angle = 2 * velocity.angleBetween(normal);
             item->setOrientation(Ogre::Quaternion::Quaternion(angle, rotationAxis));
             */
-            item->setAcceleration(acceleration);
-            item->setVelocity(velocity);
+            /*
+            Ogre::Quaternion orientation = item->getOrientation();
+            orientation = -1.0 * orientation;
+            item->setOrientation(orientation);
+            */
+            //item->setOrientation(item->getOrientation().UnitInverse() );
+            
+            item->lookAt( velocity + this->getPosition() );
+
+            item->setAcceleration(acceleration * dampingFactor);
+            item->setVelocity(velocity * dampingFactor);
         }
     }
     




More information about the Orxonox-commit mailing list