History

properties hold local velocities, not world-frame ones

Seth Alves committed 10 years ago

Commit ffce3871 parent 6a646f12 files · +12 −8Browse files

Showing the changes to libraries/entities/src/EntityScriptingInterface.cpp (1 of 2 files). Show all

Unified · Split

libraries/entities/src/EntityScriptingInterface.cpp+6−2
@@ -81,6 +81,8 @@ EntityItemProperties convertLocationToScriptSemantics(const EntityItemProperties · 80 unmodified lines
8181 entitySideProperties.getParentID(),
8282 entitySideProperties.getParentJointIndex(),
8383 success);
84+ // TODO -- handle velocity and angularVelocity
85+
8486 scriptSideProperties.setPosition(worldPosition);
8587 scriptSideProperties.setRotation(worldRotation);
8688
@@ -94,6 +96,8 @@ EntityItemProperties convertLocationFromScriptSemantics(const EntityItemProperti · 7 unmodified lines
9496 EntityItemProperties entitySideProperties = scriptSideProperties;
9597 bool success;
9698
99+ // TODO -- handle velocity and angularVelocity
100+
97101 if (scriptSideProperties.localPositionChanged()) {
98102 entitySideProperties.setPosition(scriptSideProperties.getLocalPosition());
99103 } else if (scriptSideProperties.positionChanged()) {
@@ -128,14 +132,14 @@ QUuid EntityScriptingInterface::addEntity(const EntityItemProperties& properties · 28 unmodified lines
128132 auto newVelocity = propertiesWithSimID.getVelocity().length();
129133 float cost = calculateCost(density * volume, 0, newVelocity);
130134 cost *= costMultiplier;
131−
135+
132136 if(cost > _currentAvatarEnergy) {
133137 return QUuid();
134138 } else {
135139 //debit the avatar energy and continue
136140 emit debitEnergySource(cost);
137141 }
138−
142+
139143 EntityItemID id = EntityItemID(QUuid::createUuid());
140144
141145 // If we have a local entity tree set, then also update it.