mirror of
https://github.com/overte-org/overte.git
synced 2025-08-10 02:52:57 +02:00
remove properties from RayToEntityIntersectionResult
This commit is contained in:
parent
96bb01e5f9
commit
9e71801ae1
10 changed files with 23 additions and 21 deletions
|
@ -607,7 +607,6 @@ RayToEntityIntersectionResult EntityTreeRenderer::findRayIntersectionWorker(cons
|
||||||
(void**)&intersectedEntity, lockType, &result.accurate);
|
(void**)&intersectedEntity, lockType, &result.accurate);
|
||||||
if (result.intersects && intersectedEntity) {
|
if (result.intersects && intersectedEntity) {
|
||||||
result.entityID = intersectedEntity->getEntityItemID();
|
result.entityID = intersectedEntity->getEntityItemID();
|
||||||
result.properties = intersectedEntity->getProperties();
|
|
||||||
result.intersection = ray.origin + (ray.direction * result.distance);
|
result.intersection = ray.origin + (ray.direction * result.distance);
|
||||||
result.entity = intersectedEntity;
|
result.entity = intersectedEntity;
|
||||||
}
|
}
|
||||||
|
@ -703,7 +702,9 @@ void EntityTreeRenderer::mousePressEvent(QMouseEvent* event) {
|
||||||
if (rayPickResult.intersects) {
|
if (rayPickResult.intersects) {
|
||||||
//qCDebug(entitiesrenderer) << "mousePressEvent over entity:" << rayPickResult.entityID;
|
//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);
|
QUrl url = QUrl(urlString, QUrl::StrictMode);
|
||||||
if (url.isValid() && !url.isEmpty()){
|
if (url.isValid() && !url.isEmpty()){
|
||||||
DependencyManager::get<AddressManager>()->handleLookupString(urlString);
|
DependencyManager::get<AddressManager>()->handleLookupString(urlString);
|
||||||
|
|
|
@ -668,7 +668,6 @@ RayToEntityIntersectionResult EntityScriptingInterface::findRayIntersectionWorke
|
||||||
(void**)&intersectedEntity, lockType, &result.accurate);
|
(void**)&intersectedEntity, lockType, &result.accurate);
|
||||||
if (result.intersects && intersectedEntity) {
|
if (result.intersects && intersectedEntity) {
|
||||||
result.entityID = intersectedEntity->getEntityItemID();
|
result.entityID = intersectedEntity->getEntityItemID();
|
||||||
result.properties = intersectedEntity->getProperties();
|
|
||||||
result.intersection = ray.origin + (ray.direction * result.distance);
|
result.intersection = ray.origin + (ray.direction * result.distance);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -721,7 +720,6 @@ RayToEntityIntersectionResult::RayToEntityIntersectionResult() :
|
||||||
intersects(false),
|
intersects(false),
|
||||||
accurate(true), // assume it's accurate
|
accurate(true), // assume it's accurate
|
||||||
entityID(),
|
entityID(),
|
||||||
properties(),
|
|
||||||
distance(0),
|
distance(0),
|
||||||
face(),
|
face(),
|
||||||
entity(NULL)
|
entity(NULL)
|
||||||
|
@ -737,9 +735,6 @@ QScriptValue RayToEntityIntersectionResultToScriptValue(QScriptEngine* engine, c
|
||||||
QScriptValue entityItemValue = EntityItemIDtoScriptValue(engine, value.entityID);
|
QScriptValue entityItemValue = EntityItemIDtoScriptValue(engine, value.entityID);
|
||||||
obj.setProperty("entityID", entityItemValue);
|
obj.setProperty("entityID", entityItemValue);
|
||||||
|
|
||||||
QScriptValue propertiesValue = EntityItemPropertiesToScriptValue(engine, value.properties);
|
|
||||||
obj.setProperty("properties", propertiesValue);
|
|
||||||
|
|
||||||
obj.setProperty("distance", value.distance);
|
obj.setProperty("distance", value.distance);
|
||||||
|
|
||||||
QString faceName = "";
|
QString faceName = "";
|
||||||
|
@ -785,10 +780,6 @@ void RayToEntityIntersectionResultFromScriptValue(const QScriptValue& object, Ra
|
||||||
QScriptValue entityIDValue = object.property("entityID");
|
QScriptValue entityIDValue = object.property("entityID");
|
||||||
// EntityItemIDfromScriptValue(entityIDValue, value.entityID);
|
// EntityItemIDfromScriptValue(entityIDValue, value.entityID);
|
||||||
quuidFromScriptValue(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();
|
value.distance = object.property("distance").toVariant().toFloat();
|
||||||
|
|
||||||
QString faceName = object.property("face").toVariant().toString();
|
QString faceName = object.property("face").toVariant().toString();
|
||||||
|
|
|
@ -42,7 +42,6 @@ public:
|
||||||
bool intersects;
|
bool intersects;
|
||||||
bool accurate;
|
bool accurate;
|
||||||
QUuid entityID;
|
QUuid entityID;
|
||||||
EntityItemProperties properties;
|
|
||||||
float distance;
|
float distance;
|
||||||
BoxFace face;
|
BoxFace face;
|
||||||
glm::vec3 intersection;
|
glm::vec3 intersection;
|
||||||
|
|
|
@ -142,7 +142,8 @@ function mousePressEvent(event) {
|
||||||
if (!pickResults.intersects) {
|
if (!pickResults.intersects) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (pickResults.properties.dynamic) {
|
var isDynamic = Entites.getEntityProperties(pickResults.entityID,"dynamic").dynamic;
|
||||||
|
if (isDynamic) {
|
||||||
grabbedEntity = pickResults.entityID;
|
grabbedEntity = pickResults.entityID;
|
||||||
var props = Entities.getEntityProperties(grabbedEntity)
|
var props = Entities.getEntityProperties(grabbedEntity)
|
||||||
originalGravity = props.gravity;
|
originalGravity = props.gravity;
|
||||||
|
|
|
@ -190,7 +190,10 @@ function controller(side) {
|
||||||
direction: Vec3.normalize(Vec3.subtract(this.tipPosition, this.palmPosition))
|
direction: Vec3.normalize(Vec3.subtract(this.tipPosition, this.palmPosition))
|
||||||
};
|
};
|
||||||
var intersection = getRayIntersection(pickRay, true);
|
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;
|
this.laserWasHovered = true;
|
||||||
if (this.triggerHeld && !this.grabbing) {
|
if (this.triggerHeld && !this.grabbing) {
|
||||||
this.grab(intersection.entityID);
|
this.grab(intersection.entityID);
|
||||||
|
|
|
@ -38,7 +38,6 @@ function mouseMoveEvent(event) {
|
||||||
|
|
||||||
if (intersection.intersects) {
|
if (intersection.intersects) {
|
||||||
print("intersection entityID=" + intersection.entityID);
|
print("intersection entityID=" + intersection.entityID);
|
||||||
print("intersection properties.modelURL=" + intersection.properties.modelURL);
|
|
||||||
print("intersection face=" + intersection.face);
|
print("intersection face=" + intersection.face);
|
||||||
print("intersection distance=" + intersection.distance);
|
print("intersection distance=" + intersection.distance);
|
||||||
print("intersection intersection.x/y/z=" + intersection.intersection.x + ", "
|
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
|
//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);
|
// this.intersection = Entities.findRayIntersection(pickRay, true);
|
||||||
|
|
||||||
|
var type = Entites.getEntityProperties(this.intersection.entityID,"type").type;
|
||||||
|
|
||||||
if (this.intersection.intersects) {
|
if (this.intersection.intersects) {
|
||||||
var distance = Vec3.distance(handPosition, this.intersection.intersection);
|
var distance = Vec3.distance(handPosition, this.intersection.intersection);
|
||||||
if (distance < MAX_DISTANCE) {
|
if (distance < MAX_DISTANCE) {
|
||||||
|
@ -98,7 +100,7 @@
|
||||||
this.oldPosition = null;
|
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
|
//Sometimes ray will pick against an invisible object with type unkown... so if type is unknown, ignore
|
||||||
this.stopPainting();
|
this.stopPainting();
|
||||||
}
|
}
|
||||||
|
|
|
@ -382,7 +382,10 @@ function MyController(hand) {
|
||||||
|
|
||||||
var grabbableData = getEntityCustomData(GRABBABLE_DATA_KEY, intersection.entityID, DEFAULT_GRABBABLE_DATA);
|
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;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -399,7 +402,7 @@ function MyController(hand) {
|
||||||
this.grabbedEntity = intersection.entityID;
|
this.grabbedEntity = intersection.entityID;
|
||||||
this.setState(STATE_NEAR_TRIGGER);
|
this.setState(STATE_NEAR_TRIGGER);
|
||||||
return;
|
return;
|
||||||
} else if (!intersection.properties.locked) {
|
} else if (!properties.locked) {
|
||||||
var ownerObj = getEntityCustomData('ownerKey', intersection.entityID, null);
|
var ownerObj = getEntityCustomData('ownerKey', intersection.entityID, null);
|
||||||
|
|
||||||
if (ownerObj == null || ownerObj.ownerID === MyAvatar.sessionUUID) { //I can only grab new or already mine items
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!pickResults.properties.dynamic) {
|
var isDynamic = Entites.getEntityProperties(pickResults.entityID,"dynamic").dynamic;
|
||||||
|
if (!isDynamic) {
|
||||||
// only grab dynamic objects
|
// only grab dynamic objects
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -151,8 +151,10 @@
|
||||||
});
|
});
|
||||||
}, randFloat(10, 200));
|
}, randFloat(10, 200));
|
||||||
}
|
}
|
||||||
if (intersection.properties.dynamic === 1) {
|
var isDynamic = Entites.getEntityProperties(intersection.entityID,"dynamic").dynamic;
|
||||||
// Any dynaic entity can be shot
|
|
||||||
|
if (isDynamic === 1) {
|
||||||
|
// Any dynamic entity can be shot
|
||||||
Entities.editEntity(intersection.entityID, {
|
Entities.editEntity(intersection.entityID, {
|
||||||
velocity: Vec3.multiply(this.firingDirection, this.bulletForce)
|
velocity: Vec3.multiply(this.firingDirection, this.bulletForce)
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue