mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-09 15:33:02 +02:00
Merge pull request #9796 from ZappoMan/removePropertiesFromRayPick
remove properties from RayToEntityIntersectionResult
This commit is contained in:
commit
3bdcfd8b78
10 changed files with 23 additions and 28 deletions
|
@ -608,7 +608,6 @@ RayToEntityIntersectionResult EntityTreeRenderer::findRayIntersectionWorker(cons
|
|||
(void**)&intersectedEntity, lockType, &result.accurate);
|
||||
if (result.intersects && intersectedEntity) {
|
||||
result.entityID = intersectedEntity->getEntityItemID();
|
||||
result.properties = intersectedEntity->getProperties();
|
||||
result.intersection = ray.origin + (ray.direction * result.distance);
|
||||
result.entity = intersectedEntity;
|
||||
}
|
||||
|
@ -704,7 +703,9 @@ void EntityTreeRenderer::mousePressEvent(QMouseEvent* event) {
|
|||
if (rayPickResult.intersects) {
|
||||
//qCDebug(entitiesrenderer) << "mousePressEvent over entity:" << rayPickResult.entityID;
|
||||
|
||||
QString urlString = rayPickResult.properties.getHref();
|
||||
auto entity = getTree()->findEntityByEntityItemID(rayPickResult.entityID);
|
||||
auto properties = entity->getProperties();
|
||||
QString urlString = properties.getHref();
|
||||
QUrl url = QUrl(urlString, QUrl::StrictMode);
|
||||
if (url.isValid() && !url.isEmpty()){
|
||||
DependencyManager::get<AddressManager>()->handleLookupString(urlString);
|
||||
|
@ -750,12 +751,6 @@ void EntityTreeRenderer::mouseDoublePressEvent(QMouseEvent* event) {
|
|||
if (rayPickResult.intersects) {
|
||||
//qCDebug(entitiesrenderer) << "mouseDoublePressEvent over entity:" << rayPickResult.entityID;
|
||||
|
||||
QString urlString = rayPickResult.properties.getHref();
|
||||
QUrl url = QUrl(urlString, QUrl::StrictMode);
|
||||
if (url.isValid() && !url.isEmpty()){
|
||||
DependencyManager::get<AddressManager>()->handleLookupString(urlString);
|
||||
}
|
||||
|
||||
glm::vec2 pos2D = projectOntoEntityXYPlane(rayPickResult.entity, ray, rayPickResult);
|
||||
PointerEvent pointerEvent(PointerEvent::Press, MOUSE_POINTER_ID,
|
||||
pos2D, rayPickResult.intersection,
|
||||
|
|
|
@ -673,7 +673,6 @@ RayToEntityIntersectionResult EntityScriptingInterface::findRayIntersectionWorke
|
|||
(void**)&intersectedEntity, lockType, &result.accurate);
|
||||
if (result.intersects && intersectedEntity) {
|
||||
result.entityID = intersectedEntity->getEntityItemID();
|
||||
result.properties = intersectedEntity->getProperties();
|
||||
result.intersection = ray.origin + (ray.direction * result.distance);
|
||||
}
|
||||
}
|
||||
|
@ -838,7 +837,6 @@ RayToEntityIntersectionResult::RayToEntityIntersectionResult() :
|
|||
intersects(false),
|
||||
accurate(true), // assume it's accurate
|
||||
entityID(),
|
||||
properties(),
|
||||
distance(0),
|
||||
face(),
|
||||
entity(NULL)
|
||||
|
@ -854,9 +852,6 @@ QScriptValue RayToEntityIntersectionResultToScriptValue(QScriptEngine* engine, c
|
|||
QScriptValue entityItemValue = EntityItemIDtoScriptValue(engine, value.entityID);
|
||||
obj.setProperty("entityID", entityItemValue);
|
||||
|
||||
QScriptValue propertiesValue = EntityItemPropertiesToScriptValue(engine, value.properties);
|
||||
obj.setProperty("properties", propertiesValue);
|
||||
|
||||
obj.setProperty("distance", value.distance);
|
||||
|
||||
QString faceName = "";
|
||||
|
@ -902,10 +897,6 @@ void RayToEntityIntersectionResultFromScriptValue(const QScriptValue& object, Ra
|
|||
QScriptValue entityIDValue = object.property("entityID");
|
||||
// EntityItemIDfromScriptValue(entityIDValue, value.entityID);
|
||||
quuidFromScriptValue(entityIDValue, value.entityID);
|
||||
QScriptValue entityPropertiesValue = object.property("properties");
|
||||
if (entityPropertiesValue.isValid()) {
|
||||
EntityItemPropertiesFromScriptValueHonorReadOnly(entityPropertiesValue, value.properties);
|
||||
}
|
||||
value.distance = object.property("distance").toVariant().toFloat();
|
||||
|
||||
QString faceName = object.property("face").toVariant().toString();
|
||||
|
|
|
@ -58,7 +58,6 @@ public:
|
|||
bool intersects;
|
||||
bool accurate;
|
||||
QUuid entityID;
|
||||
EntityItemProperties properties;
|
||||
float distance;
|
||||
BoxFace face;
|
||||
glm::vec3 intersection;
|
||||
|
|
|
@ -142,7 +142,8 @@ function mousePressEvent(event) {
|
|||
if (!pickResults.intersects) {
|
||||
return;
|
||||
}
|
||||
if (pickResults.properties.dynamic) {
|
||||
var isDynamic = Entites.getEntityProperties(pickResults.entityID, "dynamic").dynamic;
|
||||
if (isDynamic) {
|
||||
grabbedEntity = pickResults.entityID;
|
||||
var props = Entities.getEntityProperties(grabbedEntity)
|
||||
originalGravity = props.gravity;
|
||||
|
|
|
@ -190,7 +190,10 @@ function controller(side) {
|
|||
direction: Vec3.normalize(Vec3.subtract(this.tipPosition, this.palmPosition))
|
||||
};
|
||||
var intersection = getRayIntersection(pickRay, true);
|
||||
if (intersection.intersects && intersection.properties.dynamic) {
|
||||
|
||||
var isDynamic = Entites.getEntityProperties(intersection.entityID, "dynamic").dynamic;
|
||||
|
||||
if (intersection.intersects && isDynamic) {
|
||||
this.laserWasHovered = true;
|
||||
if (this.triggerHeld && !this.grabbing) {
|
||||
this.grab(intersection.entityID);
|
||||
|
|
|
@ -38,7 +38,6 @@ function mouseMoveEvent(event) {
|
|||
|
||||
if (intersection.intersects) {
|
||||
print("intersection entityID=" + intersection.entityID);
|
||||
print("intersection properties.modelURL=" + intersection.properties.modelURL);
|
||||
print("intersection face=" + intersection.face);
|
||||
print("intersection distance=" + intersection.distance);
|
||||
print("intersection intersection.x/y/z=" + intersection.intersection.x + ", "
|
||||
|
|
|
@ -77,6 +77,8 @@
|
|||
//Comment out above line and uncomment below line to see difference in performance between using a whitelist, and not using one
|
||||
// this.intersection = Entities.findRayIntersection(pickRay, true);
|
||||
|
||||
var type = Entites.getEntityProperties(this.intersection.entityID, "type").type;
|
||||
|
||||
if (this.intersection.intersects) {
|
||||
var distance = Vec3.distance(handPosition, this.intersection.intersection);
|
||||
if (distance < MAX_DISTANCE) {
|
||||
|
@ -98,7 +100,7 @@
|
|||
this.oldPosition = null;
|
||||
}
|
||||
}
|
||||
} else if (this.intersection.properties.type !== "Unknown") {
|
||||
} else if (type !== "Unknown") {
|
||||
//Sometimes ray will pick against an invisible object with type unkown... so if type is unknown, ignore
|
||||
this.stopPainting();
|
||||
}
|
||||
|
|
|
@ -382,7 +382,10 @@ function MyController(hand) {
|
|||
|
||||
var grabbableData = getEntityCustomData(GRABBABLE_DATA_KEY, intersection.entityID, DEFAULT_GRABBABLE_DATA);
|
||||
|
||||
if (intersection.properties.name == "Grab Debug Entity") {
|
||||
var properties = Entites.getEntityProperties(intersection.entityID, ["locked", "name"]);
|
||||
|
||||
|
||||
if (properties.name == "Grab Debug Entity") {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -399,7 +402,7 @@ function MyController(hand) {
|
|||
this.grabbedEntity = intersection.entityID;
|
||||
this.setState(STATE_NEAR_TRIGGER);
|
||||
return;
|
||||
} else if (!intersection.properties.locked) {
|
||||
} else if (!properties.locked) {
|
||||
var ownerObj = getEntityCustomData('ownerKey', intersection.entityID, null);
|
||||
|
||||
if (ownerObj == null || ownerObj.ownerID === MyAvatar.sessionUUID) { //I can only grab new or already mine items
|
||||
|
|
|
@ -343,7 +343,8 @@ Grabber.prototype.pressEvent = function(event) {
|
|||
return;
|
||||
}
|
||||
|
||||
if (!pickResults.properties.dynamic) {
|
||||
var isDynamic = Entities.getEntityProperties(pickResults.entityID, "dynamic").dynamic;
|
||||
if (!isDynamic) {
|
||||
// only grab dynamic objects
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -151,8 +151,9 @@
|
|||
});
|
||||
}, randFloat(10, 200));
|
||||
}
|
||||
if (intersection.properties.dynamic === 1) {
|
||||
// Any dynaic entity can be shot
|
||||
var isDynamic = Entities.getEntityProperties(intersection.entityID, "dynamic").dynamic;
|
||||
if (isDynamic === 1) {
|
||||
// Any dynamic entity can be shot
|
||||
Entities.editEntity(intersection.entityID, {
|
||||
velocity: Vec3.multiply(this.firingDirection, this.bulletForce)
|
||||
});
|
||||
|
@ -347,7 +348,7 @@
|
|||
this.laser = Overlays.addOverlay("line3d", {
|
||||
start: ZERO_VECTOR,
|
||||
end: ZERO_VECTOR,
|
||||
color: COLORS.RED,
|
||||
color: { red: 255, green: 0, blue: 0},
|
||||
alpha: 1,
|
||||
visible: true,
|
||||
lineWidth: 2
|
||||
|
|
Loading…
Reference in a new issue