Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErwin Coumans <blender@erwincoumans.com>2006-06-23 18:10:12 +0400
committerErwin Coumans <blender@erwincoumans.com>2006-06-23 18:10:12 +0400
commit619d0dc9ca6957e157642532ee781b934bacb66b (patch)
tree5b312110d3bd4c8649fd41f4d7c987fc34ffa6d6 /source/gameengine
parent03a1ee30b6c8093798ca06b94f2d6897493b1dff (diff)
bug: normalized raycast
Diffstat (limited to 'source/gameengine')
-rw-r--r--source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp b/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp
index d5fd194dd99..6ff471c4bd5 100644
--- a/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp
+++ b/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp
@@ -1337,6 +1337,13 @@ PHY_IPhysicsController* CcdPhysicsEnvironment::rayTest(PHY_IPhysicsController* i
SimdVector3 rayFrom(fromX,fromY,fromZ);
SimdVector3 rayTo(toX,toY,toZ);
+
+ if (m_debugDrawer->GetDebugMode() & IDebugDraw::DBG_DrawAabb)
+ {
+ SimdVector3 color (1,0,0);
+ m_debugDrawer->DrawLine(rayFrom,rayTo,color);
+ }
+
SimdVector3 hitPointWorld,normalWorld;
//Either Ray Cast with or without filtering
@@ -1354,10 +1361,26 @@ PHY_IPhysicsController* CcdPhysicsEnvironment::rayTest(PHY_IPhysicsController* i
hitX = rayCallback.m_hitPointWorld.getX();
hitY = rayCallback.m_hitPointWorld.getY();
hitZ = rayCallback.m_hitPointWorld.getZ();
+ if (rayCallback.m_hitNormalWorld.length2() > SIMD_EPSILON)
+ {
+ rayCallback.m_hitNormalWorld.normalize();
+ }
normalX = rayCallback.m_hitNormalWorld.getX();
normalY = rayCallback.m_hitNormalWorld.getY();
normalZ = rayCallback.m_hitNormalWorld.getZ();
+
+ if (m_debugDrawer->GetDebugMode() & IDebugDraw::DBG_DrawAabb)
+ {
+ SimdVector3 colorNormal(0,0,1);
+ m_debugDrawer->DrawLine(rayCallback.m_hitPointWorld,rayCallback.m_hitPointWorld+rayCallback.m_hitNormalWorld,colorNormal);
+
+ SimdVector3 color (0,1,0);
+ m_debugDrawer->DrawLine(rayFrom,rayCallback.m_hitPointWorld,color);
+
+
+ }
+
}