History

don't allow someone else to delete an action that I own. reset dynamic property when releasing and entity, even if refCount isn't 0

Seth Alves committed 10 years ago

Commit 9db839b1 parent 382a0c44 files · +13 −7Browse files

Showing the changes to libraries/physics/src/ObjectActionSpring.cpp (1 of 4 files). Show all

Unified · Split

libraries/physics/src/ObjectActionSpring.cpp+4−2
@@ -45,10 +45,9 @@ bool ObjectActionSpring::getTarget(float deltaTimeStep, glm::quat& rotation, glm · 44 unmodified lines
4545 position = _desiredPositionalTarget;
4646 linearVelocity = glm::vec3();
4747 angularVelocity = glm::vec3();
48− return true;
48+ return true;
4949 }
5050
51−
5251 bool ObjectActionSpring::prepareForSpringUpdate(btScalar deltaTimeStep) {
5352 glm::quat rotation;
5453 glm::vec3 position;
@@ -140,10 +139,13 @@ void ObjectActionSpring::updateActionWorker(btScalar deltaTimeStep) { · 85 unmodified lines
140139 float speed = glm::min(offsetLength / _linearTimeScale, SPRING_MAX_SPEED);
141140 targetVelocity = (-speed / offsetLength) * offset;
142141 if (speed > rigidBody->getLinearSleepingThreshold()) {
142+ qDebug() << "HERE";
143+ forceBodyNonStatic();
143144 rigidBody->activate();
144145 }
145146 }
146147 // this action is aggresively critically damped and defeats the current velocity
148+ qDebug() << targetVelocity.x() << targetVelocity.y() << targetVelocity.z();
147149 rigidBody->setLinearVelocity(targetVelocity);
148150 }
149151