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
45 position = _desiredPositionalTarget;45 position = _desiredPositionalTarget;
46 linearVelocity = glm::vec3();46 linearVelocity = glm::vec3();
47 angularVelocity = glm::vec3();47 angularVelocity = glm::vec3();
48 return true;48 return true;
49}49}
50 50
51
52bool ObjectActionSpring::prepareForSpringUpdate(btScalar deltaTimeStep) {51bool ObjectActionSpring::prepareForSpringUpdate(btScalar deltaTimeStep) {
53 glm::quat rotation;52 glm::quat rotation;
54 glm::vec3 position;53 glm::vec3 position;
@@ -140,10 +139,13 @@ void ObjectActionSpring::updateActionWorker(btScalar deltaTimeStep) { · 85 unmodified lines
140 float speed = glm::min(offsetLength / _linearTimeScale, SPRING_MAX_SPEED);139 float speed = glm::min(offsetLength / _linearTimeScale, SPRING_MAX_SPEED);
141 targetVelocity = (-speed / offsetLength) * offset;140 targetVelocity = (-speed / offsetLength) * offset;
142 if (speed > rigidBody->getLinearSleepingThreshold()) {141 if (speed > rigidBody->getLinearSleepingThreshold()) {
142 qDebug() << "HERE";
143 forceBodyNonStatic();
143 rigidBody->activate();144 rigidBody->activate();
144 }145 }
145 }146 }
146 // this action is aggresively critically damped and defeats the current velocity147 // this action is aggresively critically damped and defeats the current velocity
148 qDebug() << targetVelocity.x() << targetVelocity.y() << targetVelocity.z();
147 rigidBody->setLinearVelocity(targetVelocity);149 rigidBody->setLinearVelocity(targetVelocity);
148 }150 }
149 151