Showing the changes to libraries/entities/src/EntityScriptingInterface.cpp (1 of 5 files). Show all
Unified · Split
| @@ -17,6 +17,7 @@ · 16 unmodified lines | ||
| 17 | 17 | #include "ModelEntityItem.h" |
| 18 | 18 | #include "ZoneEntityItem.h" |
| 19 | 19 | #include "EntitiesLogging.h" |
| 20 | +#include "PolyVoxEntityItem.h" | |
| 20 | 21 | |
| 21 | 22 | |
| 22 | 23 | EntityScriptingInterface::EntityScriptingInterface() : |
| @@ -380,3 +381,19 @@ void RayToEntityIntersectionResultFromScriptValue(const QScriptValue& object, Ra · 357 unmodified lines | ||
| 380 | 381 | vec3FromScriptValue(intersection, value.intersection); |
| 381 | 382 | } |
| 382 | 383 | } |
| 384 | + | |
| 385 | + | |
| 386 | +bool EntityScriptingInterface::setVoxelSphere(QUuid entityID, const glm::vec3& center, float radius, int value) const { | |
| 387 | + EntityItem* entity = const_cast<EntityItem*>(_entityTree->findEntityByEntityItemID(entityID)); | |
| 388 | + if (!entity) { | |
| 389 | + return false; | |
| 390 | + } | |
| 391 | + EntityTypes::EntityType entityType = entity->getType(); | |
| 392 | + if (entityType != EntityTypes::PolyVox) { | |
| 393 | + return false; | |
| 394 | + } | |
| 395 | + | |
| 396 | + PolyVoxEntityItem* polyVoxEntity = static_cast<PolyVoxEntityItem*>(entity); | |
| 397 | + polyVoxEntity->setSphere(center, radius, value); | |
| 398 | + return true; | |
| 399 | +} | |