Showing the changes to libraries/entities/src/EntityScriptingInterface.cpp (1 of 100 files). Show all
Unified · Split
| @@ -819,13 +819,12 @@ RayToEntityIntersectionResult EntityScriptingInterface::findRayIntersectionWorke · 818 unmodified lines | |||
| 819 | RayToEntityIntersectionResult result; | 819 | RayToEntityIntersectionResult result; |
| 820 | if (_entityTree) { | 820 | if (_entityTree) { |
| 821 | OctreeElementPointer element; | 821 | OctreeElementPointer element; |
| 822 | EntityItemPointer intersectedEntity = NULL; | 822 | result.entityID = _entityTree->findRayIntersection(ray.origin, ray.direction, |
| 823 | result.intersects = _entityTree->findRayIntersection(ray.origin, ray.direction, | ||
| 824 | entityIdsToInclude, entityIdsToDiscard, visibleOnly, collidableOnly, precisionPicking, | 823 | entityIdsToInclude, entityIdsToDiscard, visibleOnly, collidableOnly, precisionPicking, |
| 825 | element, result.distance, result.face, result.surfaceNormal, | 824 | element, result.distance, result.face, result.surfaceNormal, |
| 826 | (void**)&intersectedEntity, lockType, &result.accurate); | 825 | result.extraInfo, lockType, &result.accurate); |
| 827 | if (result.intersects && intersectedEntity) { | 826 | result.intersects = !result.entityID.isNull(); |
| 828 | result.entityID = intersectedEntity->getEntityItemID(); | 827 | if (result.intersects) { |
| 829 | result.intersection = ray.origin + (ray.direction * result.distance); | 828 | result.intersection = ray.origin + (ray.direction * result.distance); |
| 830 | } | 829 | } |
| 831 | } | 830 | } |
| @@ -991,8 +990,7 @@ RayToEntityIntersectionResult::RayToEntityIntersectionResult() : · 159 unmodified lines | |||
| 991 | accurate(true), // assume it's accurate | 990 | accurate(true), // assume it's accurate |
| 992 | entityID(), | 991 | entityID(), |
| 993 | distance(0), | 992 | distance(0), |
| 994 | face(), | 993 | face() |
| 995 | entity(NULL) | ||
| 996 | { | 994 | { |
| 997 | } | 995 | } |
| 998 | 996 | ||
| @@ -1039,6 +1037,7 @@ QScriptValue RayToEntityIntersectionResultToScriptValue(QScriptEngine* engine, c · 40 unmodified lines | |||
| 1039 | 1037 | ||
| 1040 | QScriptValue surfaceNormal = vec3toScriptValue(engine, value.surfaceNormal); | 1038 | QScriptValue surfaceNormal = vec3toScriptValue(engine, value.surfaceNormal); |
| 1041 | obj.setProperty("surfaceNormal", surfaceNormal); | 1039 | obj.setProperty("surfaceNormal", surfaceNormal); |
| 1040 | obj.setProperty("extraInfo", engine->toScriptValue(value.extraInfo)); | ||
| 1042 | return obj; | 1041 | return obj; |
| 1043 | } | 1042 | } |
| 1044 | 1043 | ||
| @@ -1074,6 +1073,7 @@ void RayToEntityIntersectionResultFromScriptValue(const QScriptValue& object, Ra · 29 unmodified lines | |||
| 1074 | if (surfaceNormal.isValid()) { | 1073 | if (surfaceNormal.isValid()) { |
| 1075 | vec3FromScriptValue(surfaceNormal, value.surfaceNormal); | 1074 | vec3FromScriptValue(surfaceNormal, value.surfaceNormal); |
| 1076 | } | 1075 | } |
| 1076 | value.extraInfo = object.property("extraInfo").toVariant().toMap(); | ||
| 1077 | } | 1077 | } |
| 1078 | 1078 | ||
| 1079 | bool EntityScriptingInterface::polyVoxWorker(QUuid entityID, std::function<bool(PolyVoxEntityItem&)> actor) { | 1079 | bool EntityScriptingInterface::polyVoxWorker(QUuid entityID, std::function<bool(PolyVoxEntityItem&)> actor) { |