History

if a hold action is edited by a local script, mark it as 'mine'. if it's not 'mine', let the spring action handle the wire protocol

Seth Alves committed 11 years ago

Commit 88fc7431 parent 0a734c93 files · +32 −55Browse files

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

Unified · Split

libraries/physics/src/ObjectActionSpring.cpp+7−0
@@ -13,6 +13,8 @@ · 12 unmodified lines
1313
1414 #include "ObjectActionSpring.h"
1515
16+const float SPRING_MAX_SPEED = 10.0f;
17+
1618 const uint16_t ObjectActionSpring::springVersion = 1;
1719
1820 ObjectActionSpring::ObjectActionSpring(EntityActionType type, QUuid id, EntityItemPointer ownerEntity) :
@@ -70,6 +72,11 @@ void ObjectActionSpring::updateActionWorker(btScalar deltaTimeStep) { · 51 unmodified lines
7072 float offsetLength = glm::length(offset);
7173 float speed = offsetLength / _linearTimeScale;
7274
75+ // cap speed
76+ if (speed > SPRING_MAX_SPEED) {
77+ speed = SPRING_MAX_SPEED;
78+ }
79+
7380 if (offsetLength > IGNORE_POSITION_DELTA) {
7481 glm::vec3 newVelocity = glm::normalize(offset) * speed;
7582 rigidBody->setLinearVelocity(glmToBullet(newVelocity));

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t