projects
/
blender.git
/ commitdiff
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
0e094ff
)
fixing some issues: force needs to wake up objects, property sensor issue, island...
author
Erwin Coumans <blender@erwincoumans.com>
Mon, 25 Dec 2006 02:02:13 +0000
(
02:02
+0000)
committer
Erwin Coumans <blender@erwincoumans.com>
Mon, 25 Dec 2006 02:02:13 +0000
(
02:02
+0000)
extern/bullet2/src/BulletCollision/CollisionDispatch/btSimulationIslandManager.cpp
patch
|
blob
|
history
extern/bullet2/src/LinearMath/btAlignedObjectArray.h
patch
|
blob
|
history
source/gameengine/GameLogic/SCA_PropertySensor.cpp
patch
|
blob
|
history
source/gameengine/Ketsji/KXNetwork/KX_NetworkMessageSensor.cpp
patch
|
blob
|
history
source/gameengine/Physics/Bullet/CcdPhysicsController.cpp
patch
|
blob
|
history
source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp
patch
|
blob
|
history
diff --git
a/extern/bullet2/src/BulletCollision/CollisionDispatch/btSimulationIslandManager.cpp
b/extern/bullet2/src/BulletCollision/CollisionDispatch/btSimulationIslandManager.cpp
index 3f51e9ec0a61472f225c5bd777e0d03ebba23dda..5a642643eedc370ed05c51dfc1bd713c7b38edcd 100644
(file)
--- a/
extern/bullet2/src/BulletCollision/CollisionDispatch/btSimulationIslandManager.cpp
+++ b/
extern/bullet2/src/BulletCollision/CollisionDispatch/btSimulationIslandManager.cpp
@@
-271,41
+271,50
@@
void btSimulationIslandManager::buildAndProcessIslands(btDispatcher* dispatcher,
int islandId;
int islandId;
- //update the sleeping state for bodies, if all are sleeping
+ //solve the constraint for each islands, if there are contacts/constraints
for (int startIslandIndex=0;startIslandIndex<numElem;startIslandIndex = endIslandIndex)
{
int islandId = getUnionFind().getElement(startIslandIndex).m_id;
for (int startIslandIndex=0;startIslandIndex<numElem;startIslandIndex = endIslandIndex)
{
int islandId = getUnionFind().getElement(startIslandIndex).m_id;
- for (endIslandIndex = startIslandIndex+1;(endIslandIndex<numElem) && (getUnionFind().getElement(endIslandIndex).m_id == islandId);endIslandIndex++)
+ bool islandSleeping = false;
+
+ for (endIslandIndex = startIslandIndex;(endIslandIndex<numElem) && (getUnionFind().getElement(endIslandIndex).m_id == islandId);endIslandIndex++)
{
{
+ int i = getUnionFind().getElement(endIslandIndex).m_sz;
+ btCollisionObject* colObj0 = collisionObjects[i];
+ if (!colObj0->isActive())
+ islandSleeping = true;
}
}
- //find the accompanying contact manifold for this islandId
- int numIslandManifolds = 0;
- btPersistentManifold** startManifold = 0;
-
- if (startManifoldIndex<numManifolds)
+ if (!islandSleeping)
{
{
- int curIslandId = getIslandId(islandmanifold[startManifoldIndex]);
- if (curIslandId == islandId)
+ //find the accompanying contact manifold for this islandId
+ int numIslandManifolds = 0;
+ btPersistentManifold** startManifold = 0;
+
+ if (startManifoldIndex<numManifolds)
{
{
- startManifold = &islandmanifold[startManifoldIndex];
-
- for (endManifoldIndex = startManifoldIndex+1;(endManifoldIndex<numManifolds) && (islandId == getIslandId(islandmanifold[endManifoldIndex]));endManifoldIndex++)
+ int curIslandId = getIslandId(islandmanifold[startManifoldIndex]);
+ if (curIslandId == islandId)
{
{
+ startManifold = &islandmanifold[startManifoldIndex];
+
+ for (endManifoldIndex = startManifoldIndex+1;(endManifoldIndex<numManifolds) && (islandId == getIslandId(islandmanifold[endManifoldIndex]));endManifoldIndex++)
+ {
+ }
+ /// Process the actual simulation, only if not sleeping/deactivated
+ numIslandManifolds = endManifoldIndex-startManifoldIndex;
}
}
- /// Process the actual simulation, only if not sleeping/deactivated
- numIslandManifolds = endManifoldIndex-startManifoldIndex;
- }
- }
+
}
- callback->ProcessIsland(startManifold,numIslandManifolds, islandId);
+
callback->ProcessIsland(startManifold,numIslandManifolds, islandId);
- if (numIslandManifolds)
- {
- startManifoldIndex = endManifoldIndex;
+ if (numIslandManifolds)
+ {
+ startManifoldIndex = endManifoldIndex;
+ }
}
}
}
}
}
}
diff --git
a/extern/bullet2/src/LinearMath/btAlignedObjectArray.h
b/extern/bullet2/src/LinearMath/btAlignedObjectArray.h
index 79469c03c293d0eee30698fcea073ec629e43cc4..3a66ebbec2275c2708e86a560ea6856da8f15e28 100644
(file)
--- a/
extern/bullet2/src/LinearMath/btAlignedObjectArray.h
+++ b/
extern/bullet2/src/LinearMath/btAlignedObjectArray.h
@@
-68,8
+68,10
@@
class btAlignedObjectArray
SIMD_FORCE_INLINE void deallocate()
{
SIMD_FORCE_INLINE void deallocate()
{
- if(m_data)
+ if(m_data)
{
m_allocator.deallocate(m_data);
m_allocator.deallocate(m_data);
+ m_data = 0;
+ }
}
}
diff --git
a/source/gameengine/GameLogic/SCA_PropertySensor.cpp
b/source/gameengine/GameLogic/SCA_PropertySensor.cpp
index 979ce51ab5e55eefcfc9368f2bae50c48dccfc78..09332b870c92ca8f16937b01bcdd007aacb179d4 100644
(file)
--- a/
source/gameengine/GameLogic/SCA_PropertySensor.cpp
+++ b/
source/gameengine/GameLogic/SCA_PropertySensor.cpp
@@
-268,7
+268,7
@@
bool SCA_PropertySensor::CheckPropertyCondition()
m_recentresult=result;
} else
{
m_recentresult=result;
} else
{
- m_recentresult=true;
+ m_recentresult=
result;//
true;
}
return result;
}
}
return result;
}
diff --git
a/source/gameengine/Ketsji/KXNetwork/KX_NetworkMessageSensor.cpp
b/source/gameengine/Ketsji/KXNetwork/KX_NetworkMessageSensor.cpp
index 67f4fb69e72540a9658aff37d060a8fe42cf1012..a01673f569fbadf3d366bac0372ac1b2aca76451 100644
(file)
--- a/
source/gameengine/Ketsji/KXNetwork/KX_NetworkMessageSensor.cpp
+++ b/
source/gameengine/Ketsji/KXNetwork/KX_NetworkMessageSensor.cpp
@@
-90,7
+90,8
@@
bool KX_NetworkMessageSensor::Evaluate(CValue* event)
bool result = false;
bool WasUp = m_IsUp;
bool result = false;
bool WasUp = m_IsUp;
- m_IsUp = false;
+// m_IsUp = false;
+
if (m_BodyList) {
m_BodyList->Release();
m_BodyList = NULL;
if (m_BodyList) {
m_BodyList->Release();
m_BodyList = NULL;
diff --git
a/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp
b/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp
index 3ddac72618db2d88911968826ae907e5ab7ac8f8..d3eb4db6f35a55e4bd461b2bd9eab58cb3b96254 100644
(file)
--- a/
source/gameengine/Physics/Bullet/CcdPhysicsController.cpp
+++ b/
source/gameengine/Physics/Bullet/CcdPhysicsController.cpp
@@
-379,6
+379,10
@@
void CcdPhysicsController::ApplyTorque(float torqueX,float torqueY,float torque
{
btVector3 torque(torqueX,torqueY,torqueZ);
btTransform xform = m_body->getCenterOfMassTransform();
{
btVector3 torque(torqueX,torqueY,torqueZ);
btTransform xform = m_body->getCenterOfMassTransform();
+ if (torque.length2() > (SIMD_EPSILON*SIMD_EPSILON))
+ {
+ m_body->activate();
+ }
if (local)
{
torque = xform.getBasis()*torque;
if (local)
{
torque = xform.getBasis()*torque;
@@
-389,6
+393,13
@@
void CcdPhysicsController::ApplyTorque(float torqueX,float torqueY,float torque
void CcdPhysicsController::ApplyForce(float forceX,float forceY,float forceZ,bool local)
{
btVector3 force(forceX,forceY,forceZ);
void CcdPhysicsController::ApplyForce(float forceX,float forceY,float forceZ,bool local)
{
btVector3 force(forceX,forceY,forceZ);
+
+ if (force.length2() > (SIMD_EPSILON*SIMD_EPSILON))
+ {
+ m_body->activate();
+ }
+
+
btTransform xform = m_body->getCenterOfMassTransform();
if (local)
{
btTransform xform = m_body->getCenterOfMassTransform();
if (local)
{
diff --git
a/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp
b/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp
index 57fe533825e369b9a273e826497f649bc86d6ce9..bb6b62c7edcdb70b30789617a27244514e22583e 100644
(file)
--- a/
source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp
+++ b/
source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp
@@
-653,6
+653,8
@@
void CcdPhysicsEnvironment::removeConstraint(int constraintId)
btTypedConstraint* constraint = m_dynamicsWorld->getConstraint(i);
if (constraint->getUserConstraintId() == constraintId)
{
btTypedConstraint* constraint = m_dynamicsWorld->getConstraint(i);
if (constraint->getUserConstraintId() == constraintId)
{
+ constraint->getRigidBodyA().activate();
+ constraint->getRigidBodyB().activate();
m_dynamicsWorld->removeConstraint(constraint);
break;
}
m_dynamicsWorld->removeConstraint(constraint);
break;
}