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:
Diffstat (limited to 'extern/bullet/Extras/PhysicsInterface/CcdPhysics/CcdPhysicsEnvironment.cpp')
-rw-r--r--extern/bullet/Extras/PhysicsInterface/CcdPhysics/CcdPhysicsEnvironment.cpp38
1 files changed, 38 insertions, 0 deletions
diff --git a/extern/bullet/Extras/PhysicsInterface/CcdPhysics/CcdPhysicsEnvironment.cpp b/extern/bullet/Extras/PhysicsInterface/CcdPhysics/CcdPhysicsEnvironment.cpp
index d5fd194dd99..2fee6d06963 100644
--- a/extern/bullet/Extras/PhysicsInterface/CcdPhysics/CcdPhysicsEnvironment.cpp
+++ b/extern/bullet/Extras/PhysicsInterface/CcdPhysics/CcdPhysicsEnvironment.cpp
@@ -1271,6 +1271,21 @@ int CcdPhysicsEnvironment::createConstraint(class PHY_IPhysicsController* ctrl
}
+float CcdPhysicsEnvironment::getAppliedImpulse(int constraintid)
+{
+ std::vector<TypedConstraint*>::iterator i;
+
+ for (i=m_constraints.begin();
+ !(i==m_constraints.end()); i++)
+ {
+ TypedConstraint* constraint = (*i);
+ if (constraint->GetUserConstraintId() == constraintid)
+ {
+ return constraint->GetAppliedImpulse();
+ }
+ }
+ return 0.f;
+}
void CcdPhysicsEnvironment::removeConstraint(int constraintId)
{
std::vector<TypedConstraint*>::iterator i;
@@ -1337,6 +1352,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 +1376,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);
+
+
+ }
+
}