glm::vec3 EntityScriptingInterface::worldCoordsToVoxelCoords(const QUuid& entityID, glm::vec3 worldCoords) {
    if (auto entity = checkForTreeEntityAndTypeMatch(entityID, EntityTypes::PolyVox)) {
        auto polyVoxEntity = std::dynamic_pointer_cast<PolyVoxEntityItem>(entity);
        return polyVoxEntity->worldCoordsToVoxelCoords(worldCoords);
    } else {
        return glm::vec3(0.0f);
    }
}
glm::vec3 EntityScriptingInterface::worldCoordsToVoxelCoords(const QUuid& entityID, glm::vec3 worldCoords) {
    if (!_entityTree) {
        return glm::vec3(0.0f);
    }

    EntityItemPointer entity = _entityTree->findEntityByEntityItemID(entityID);
    if (!entity) {
        qCDebug(entities) << "EntityScriptingInterface::worldCoordsToVoxelCoords no entity with ID" << entityID;
        return glm::vec3(0.0f);
    }

    EntityTypes::EntityType entityType = entity->getType();
    if (entityType != EntityTypes::PolyVox) {
        return glm::vec3(0.0f);
    }

    auto polyVoxEntity = std::dynamic_pointer_cast<PolyVoxEntityItem>(entity);
    return polyVoxEntity->worldCoordsToVoxelCoords(worldCoords);
}