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
13 13
14#include "ObjectActionSpring.h"14#include "ObjectActionSpring.h"
15 15
16const float SPRING_MAX_SPEED = 10.0f;
17
16const uint16_t ObjectActionSpring::springVersion = 1;18const uint16_t ObjectActionSpring::springVersion = 1;
17 19
18ObjectActionSpring::ObjectActionSpring(EntityActionType type, QUuid id, EntityItemPointer ownerEntity) :20ObjectActionSpring::ObjectActionSpring(EntityActionType type, QUuid id, EntityItemPointer ownerEntity) :
@@ -70,6 +72,11 @@ void ObjectActionSpring::updateActionWorker(btScalar deltaTimeStep) { · 51 unmodified lines
70 float offsetLength = glm::length(offset);72 float offsetLength = glm::length(offset);
71 float speed = offsetLength / _linearTimeScale;73 float speed = offsetLength / _linearTimeScale;
72 74
75 // cap speed
76 if (speed > SPRING_MAX_SPEED) {
77 speed = SPRING_MAX_SPEED;
78 }
79
73 if (offsetLength > IGNORE_POSITION_DELTA) {80 if (offsetLength > IGNORE_POSITION_DELTA) {
74 glm::vec3 newVelocity = glm::normalize(offset) * speed;81 glm::vec3 newVelocity = glm::normalize(offset) * speed;
75 rigidBody->setLinearVelocity(glmToBullet(newVelocity));82 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