Showing the changes to libraries/physics/src/ObjectActionSpring.cpp (1 of 4 files). Show all
Unified · Split
| @@ -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 | |||
| 52 | bool ObjectActionSpring::prepareForSpringUpdate(btScalar deltaTimeStep) { | 51 | bool 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 velocity | 147 | // 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 | ||