Showing the changes to libraries/entities/src/EntityScriptingInterface.cpp (1 of 2 files). Show all
Unified · Split
| @@ -123,10 +123,10 @@ QUuid EntityScriptingInterface::addEntity(const EntityItemProperties& properties · 122 unmodified lines | ||
| 123 | 123 | propertiesWithSimID.setDimensionsInitialized(properties.dimensionsChanged()); |
| 124 | 124 | |
| 125 | 125 | auto dimensions = propertiesWithSimID.getDimensions(); |
| 126 | − float volume = dimensions.x*dimensions.y*dimensions.z; | |
| 126 | + float volume = dimensions.x * dimensions.y * dimensions.z; | |
| 127 | 127 | auto density = propertiesWithSimID.getDensity(); |
| 128 | 128 | auto newVelocity = propertiesWithSimID.getVelocity().length(); |
| 129 | − double cost = calculateCost(density*volume, 0, newVelocity); | |
| 129 | + double cost = calculateCost(density * volume, 0, newVelocity); | |
| 130 | 130 | cost *= costMultiplier; |
| 131 | 131 | |
| 132 | 132 | if(cost > _currentAvatarEnergy) { |
| @@ -231,10 +231,10 @@ QUuid EntityScriptingInterface::editEntity(QUuid id, const EntityItemProperties& · 98 unmodified lines | ||
| 231 | 231 | EntityItemProperties properties = scriptSideProperties; |
| 232 | 232 | |
| 233 | 233 | auto dimensions = properties.getDimensions(); |
| 234 | − float volume = dimensions.x*dimensions.y*dimensions.z; | |
| 234 | + float volume = dimensions.x * dimensions.y * dimensions.z; | |
| 235 | 235 | auto density = properties.getDensity(); |
| 236 | 236 | auto newVelocity = properties.getVelocity().length(); |
| 237 | − double cost = calculateCost(density*volume, 0, newVelocity); | |
| 237 | + double cost = calculateCost(density * volume, 0, newVelocity); | |
| 238 | 238 | cost *= costMultiplier; |
| 239 | 239 | |
| 240 | 240 | if(cost > _currentAvatarEnergy) { |
| @@ -351,10 +351,10 @@ void EntityScriptingInterface::deleteEntity(QUuid id) { · 110 unmodified lines | ||
| 351 | 351 | if (entity) { |
| 352 | 352 | |
| 353 | 353 | auto dimensions = entity->getDimensions(); |
| 354 | − float volume = dimensions.x*dimensions.y*dimensions.z; | |
| 354 | + float volume = dimensions.x * dimensions.y * dimensions.z; | |
| 355 | 355 | auto density = entity->getDensity(); |
| 356 | 356 | auto velocity = entity->getVelocity().length(); |
| 357 | − double cost = calculateCost(density*volume, velocity, 0); | |
| 357 | + double cost = calculateCost(density * volume, velocity, 0); | |
| 358 | 358 | cost *= costMultiplier; |
| 359 | 359 | |
| 360 | 360 | if(cost > _currentAvatarEnergy) { |
| @@ -1041,7 +1041,7 @@ QStringList EntityScriptingInterface::getJointNames(const QUuid& entityID) { · 680 unmodified lines | ||
| 1041 | 1041 | return result; |
| 1042 | 1042 | } |
| 1043 | 1043 | |
| 1044 | −float EntityScriptingInterface::calculateCost(float mass, float oldVelocity,float newVelocity) { | |
| 1044 | +float EntityScriptingInterface::calculateCost(float mass, float oldVelocity, float newVelocity) { | |
| 1045 | 1045 | return std::abs(mass * (newVelocity - oldVelocity)); |
| 1046 | 1046 | } |
| 1047 | 1047 | |