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
81 entitySideProperties.getParentID(),81 entitySideProperties.getParentID(),
82 entitySideProperties.getParentJointIndex(),82 entitySideProperties.getParentJointIndex(),
83 success);83 success);
84 // TODO -- handle velocity and angularVelocity
85
84 scriptSideProperties.setPosition(worldPosition);86 scriptSideProperties.setPosition(worldPosition);
85 scriptSideProperties.setRotation(worldRotation);87 scriptSideProperties.setRotation(worldRotation);
86 88
@@ -94,6 +96,8 @@ EntityItemProperties convertLocationFromScriptSemantics(const EntityItemProperti · 7 unmodified lines
94 EntityItemProperties entitySideProperties = scriptSideProperties;96 EntityItemProperties entitySideProperties = scriptSideProperties;
95 bool success;97 bool success;
96 98
99 // TODO -- handle velocity and angularVelocity
100
97 if (scriptSideProperties.localPositionChanged()) {101 if (scriptSideProperties.localPositionChanged()) {
98 entitySideProperties.setPosition(scriptSideProperties.getLocalPosition());102 entitySideProperties.setPosition(scriptSideProperties.getLocalPosition());
99 } else if (scriptSideProperties.positionChanged()) {103 } else if (scriptSideProperties.positionChanged()) {
@@ -128,14 +132,14 @@ QUuid EntityScriptingInterface::addEntity(const EntityItemProperties& properties · 28 unmodified lines
128 auto newVelocity = propertiesWithSimID.getVelocity().length();132 auto newVelocity = propertiesWithSimID.getVelocity().length();
129 float cost = calculateCost(density * volume, 0, newVelocity);133 float cost = calculateCost(density * volume, 0, newVelocity);
130 cost *= costMultiplier;134 cost *= costMultiplier;
131 135
132 if(cost > _currentAvatarEnergy) {136 if(cost > _currentAvatarEnergy) {
133 return QUuid();137 return QUuid();
134 } else {138 } else {
135 //debit the avatar energy and continue139 //debit the avatar energy and continue
136 emit debitEnergySource(cost);140 emit debitEnergySource(cost);
137 }141 }
138 142
139 EntityItemID id = EntityItemID(QUuid::createUuid());143 EntityItemID id = EntityItemID(QUuid::createUuid());
140 144
141 // If we have a local entity tree set, then also update it.145 // If we have a local entity tree set, then also update it.