mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 22:51:20 +02:00
Merge branch 'master' into tony/grab-script-hand-animation
This commit is contained in:
commit
1251be1b2b
8 changed files with 150 additions and 102 deletions
|
@ -41,6 +41,7 @@ var DISTANCE_HOLDING_RADIUS_FACTOR = 3.5; // multiplied by distance between hand
|
||||||
var DISTANCE_HOLDING_ACTION_TIMEFRAME = 0.1; // how quickly objects move to their new position
|
var DISTANCE_HOLDING_ACTION_TIMEFRAME = 0.1; // how quickly objects move to their new position
|
||||||
var DISTANCE_HOLDING_ROTATION_EXAGGERATION_FACTOR = 2.0; // object rotates this much more than hand did
|
var DISTANCE_HOLDING_ROTATION_EXAGGERATION_FACTOR = 2.0; // object rotates this much more than hand did
|
||||||
var MOVE_WITH_HEAD = true; // experimental head-controll of distantly held objects
|
var MOVE_WITH_HEAD = true; // experimental head-controll of distantly held objects
|
||||||
|
var FAR_TO_NEAR_GRAB_PADDING_FACTOR = 1.2;
|
||||||
|
|
||||||
var NO_INTERSECT_COLOR = {
|
var NO_INTERSECT_COLOR = {
|
||||||
red: 10,
|
red: 10,
|
||||||
|
@ -655,9 +656,9 @@ function MyController(hand) {
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
this.renewParticleBeamLifetime = function(){
|
this.renewParticleBeamLifetime = function() {
|
||||||
var props = Entities.getEntityProperties(this.particleBeam,"age");
|
var props = Entities.getEntityProperties(this.particleBeam, "age");
|
||||||
Entities.editEntity(this.particleBeam,{
|
Entities.editEntity(this.particleBeam, {
|
||||||
lifetime: TEMPORARY_PARTICLE_BEAM_LIFETIME + props.age // renew lifetime
|
lifetime: TEMPORARY_PARTICLE_BEAM_LIFETIME + props.age // renew lifetime
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -980,11 +981,19 @@ function MyController(hand) {
|
||||||
if (intersection.properties.collisionsWillMove && !intersection.properties.locked) {
|
if (intersection.properties.collisionsWillMove && !intersection.properties.locked) {
|
||||||
// the hand is far from the intersected object. go into distance-holding mode
|
// the hand is far from the intersected object. go into distance-holding mode
|
||||||
this.grabbedEntity = intersection.entityID;
|
this.grabbedEntity = intersection.entityID;
|
||||||
if (typeof grabbableData.spatialKey !== 'undefined' && this.state == STATE_EQUIP_SEARCHING) {
|
if (this.state == STATE_EQUIP_SEARCHING) {
|
||||||
// if a distance pick in equip mode hits something with a spatialKey, equip it
|
// if a distance pick in equip mode hits something with a spatialKey, equip it
|
||||||
// TODO use STATE_EQUIP_SPRING here once it works right.
|
// TODO use STATE_EQUIP_SPRING here once it works right.
|
||||||
// this.setState(STATE_EQUIP_SPRING);
|
// this.setState(STATE_EQUIP_SPRING);
|
||||||
|
if (typeof grabbableData.spatialKey === 'undefined') {
|
||||||
|
// We want to give a temporary position offset to this object so it is pulled close to hand
|
||||||
|
var intersectionPointToCenterDistance = Vec3.length(Vec3.subtract(intersection.intersection, intersection.properties.position));
|
||||||
|
this.temporaryPositionOffset = Vec3.normalize(Vec3.subtract(intersection.properties.position, handPosition));
|
||||||
|
this.temporaryPositionOffset = Vec3.multiply(this.temporaryPositionOffset, intersectionPointToCenterDistance * FAR_TO_NEAR_GRAB_PADDING_FACTOR);
|
||||||
|
|
||||||
|
}
|
||||||
this.setState(STATE_EQUIP);
|
this.setState(STATE_EQUIP);
|
||||||
|
this.turnOffVisualizations();
|
||||||
return;
|
return;
|
||||||
} else if ((this.state == STATE_SEARCHING) && this.triggerSmoothedGrab()) {
|
} else if ((this.state == STATE_SEARCHING) && this.triggerSmoothedGrab()) {
|
||||||
this.setState(STATE_DISTANCE_HOLDING);
|
this.setState(STATE_DISTANCE_HOLDING);
|
||||||
|
@ -1370,103 +1379,107 @@ function MyController(hand) {
|
||||||
|
|
||||||
this.projectVectorAlongAxis = function(position, axisStart, axisEnd) {
|
this.projectVectorAlongAxis = function(position, axisStart, axisEnd) {
|
||||||
|
|
||||||
var aPrime = Vec3.subtract(position, axisStart);
|
var aPrime = Vec3.subtract(position, axisStart);
|
||||||
|
|
||||||
|
|
||||||
var bPrime = Vec3.subtract(axisEnd, axisStart);
|
var bPrime = Vec3.subtract(axisEnd, axisStart);
|
||||||
|
|
||||||
|
|
||||||
var bPrimeMagnitude = Vec3.length(bPrime);
|
var bPrimeMagnitude = Vec3.length(bPrime);
|
||||||
|
|
||||||
var dotProduct = Vec3.dot(aPrime, bPrime);
|
var dotProduct = Vec3.dot(aPrime, bPrime);
|
||||||
|
|
||||||
|
|
||||||
var scalar = dotProduct / bPrimeMagnitude;
|
var scalar = dotProduct / bPrimeMagnitude;
|
||||||
|
|
||||||
if (scalar < 0) {
|
if (scalar < 0) {
|
||||||
scalar = 0;
|
scalar = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (scalar > 1) {
|
||||||
|
scalar = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
var projection = Vec3.sum(axisStart, Vec3.multiply(scalar, Vec3.normalize(bPrime)));
|
||||||
|
|
||||||
|
return projection
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
this.nearGrabbing = function() {
|
||||||
|
var now = Date.now();
|
||||||
|
var grabbableData = getEntityCustomData(GRABBABLE_DATA_KEY, this.grabbedEntity, DEFAULT_GRABBABLE_DATA);
|
||||||
|
|
||||||
|
if (this.state == STATE_NEAR_GRABBING && this.triggerSmoothedReleased()) {
|
||||||
|
this.setState(STATE_RELEASE);
|
||||||
|
Entities.callEntityMethod(this.grabbedEntity, "releaseGrab");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.lineOff();
|
||||||
|
this.overlayLineOff();
|
||||||
|
|
||||||
|
var grabbedProperties = Entities.getEntityProperties(this.grabbedEntity, GRABBABLE_PROPERTIES);
|
||||||
|
this.activateEntity(this.grabbedEntity, grabbedProperties);
|
||||||
|
if (grabbedProperties.collisionsWillMove && NEAR_GRABBING_KINEMATIC) {
|
||||||
|
Entities.editEntity(this.grabbedEntity, {
|
||||||
|
collisionsWillMove: false
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
var handRotation = this.getHandRotation();
|
||||||
|
var handPosition = this.getHandPosition();
|
||||||
|
|
||||||
|
var grabbableData = getEntityCustomData(GRABBABLE_DATA_KEY, this.grabbedEntity, DEFAULT_GRABBABLE_DATA);
|
||||||
|
|
||||||
|
if (this.state != STATE_NEAR_GRABBING && grabbableData.spatialKey) {
|
||||||
|
// if an object is "equipped" and has a spatialKey, use it.
|
||||||
|
this.ignoreIK = grabbableData.spatialKey.ignoreIK ? grabbableData.spatialKey.ignoreIK : false;
|
||||||
|
this.offsetPosition = getSpatialOffsetPosition(this.hand, grabbableData.spatialKey);
|
||||||
|
this.offsetRotation = getSpatialOffsetRotation(this.hand, grabbableData.spatialKey);
|
||||||
|
} else {
|
||||||
|
this.ignoreIK = false;
|
||||||
|
|
||||||
|
var objectRotation = grabbedProperties.rotation;
|
||||||
|
this.offsetRotation = Quat.multiply(Quat.inverse(handRotation), objectRotation);
|
||||||
|
|
||||||
|
var currentObjectPosition = grabbedProperties.position;
|
||||||
|
var offset = Vec3.subtract(currentObjectPosition, handPosition);
|
||||||
|
this.offsetPosition = Vec3.multiplyQbyV(Quat.inverse(Quat.multiply(handRotation, this.offsetRotation)), offset);
|
||||||
|
if (this.temporaryPositionOffset && this.state != STATE_NEAR_GRABBING) {
|
||||||
|
this.offsetPosition = this.temporaryPositionOffset;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (scalar > 1) {
|
|
||||||
scalar = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
var projection = Vec3.sum(axisStart, Vec3.multiply(scalar, Vec3.normalize(bPrime)));
|
if (!this.setupHoldAction()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
return projection
|
if (this.state == STATE_NEAR_GRABBING) {
|
||||||
|
this.setState(STATE_CONTINUE_NEAR_GRABBING);
|
||||||
|
} else {
|
||||||
|
// equipping
|
||||||
|
Entities.callEntityMethod(this.grabbedEntity, "startEquip", [JSON.stringify(this.hand)]);
|
||||||
|
this.startHandGrasp();
|
||||||
|
|
||||||
};
|
this.setState(STATE_CONTINUE_EQUIP_BD);
|
||||||
|
}
|
||||||
|
|
||||||
this.nearGrabbing = function() {
|
if (this.hand === RIGHT_HAND) {
|
||||||
var now = Date.now();
|
Entities.callEntityMethod(this.grabbedEntity, "setRightHand");
|
||||||
var grabbableData = getEntityCustomData(GRABBABLE_DATA_KEY, this.grabbedEntity, DEFAULT_GRABBABLE_DATA);
|
} else {
|
||||||
|
Entities.callEntityMethod(this.grabbedEntity, "setLeftHand");
|
||||||
|
}
|
||||||
|
|
||||||
if (this.state == STATE_NEAR_GRABBING && this.triggerSmoothedReleased()) {
|
Entities.callEntityMethod(this.grabbedEntity, "setHand", [this.hand]);
|
||||||
this.setState(STATE_RELEASE);
|
Entities.callEntityMethod(this.grabbedEntity, "startNearGrab");
|
||||||
Entities.callEntityMethod(this.grabbedEntity, "releaseGrab");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.lineOff();
|
this.currentHandControllerTipPosition =
|
||||||
this.overlayLineOff();
|
(this.hand === RIGHT_HAND) ? MyAvatar.rightHandTipPosition : MyAvatar.leftHandTipPosition;
|
||||||
|
|
||||||
var grabbedProperties = Entities.getEntityProperties(this.grabbedEntity, GRABBABLE_PROPERTIES);
|
this.currentObjectTime = Date.now();
|
||||||
this.activateEntity(this.grabbedEntity, grabbedProperties);
|
};
|
||||||
if (grabbedProperties.collisionsWillMove && NEAR_GRABBING_KINEMATIC) {
|
|
||||||
Entities.editEntity(this.grabbedEntity, {
|
|
||||||
collisionsWillMove: false
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
var handRotation = this.getHandRotation();
|
|
||||||
var handPosition = this.getHandPosition();
|
|
||||||
|
|
||||||
var grabbableData = getEntityCustomData(GRABBABLE_DATA_KEY, this.grabbedEntity, DEFAULT_GRABBABLE_DATA);
|
|
||||||
|
|
||||||
if (this.state != STATE_NEAR_GRABBING && grabbableData.spatialKey) {
|
|
||||||
// if an object is "equipped" and has a spatialKey, use it.
|
|
||||||
this.ignoreIK = grabbableData.spatialKey.ignoreIK ? grabbableData.spatialKey.ignoreIK : false;
|
|
||||||
this.offsetPosition = getSpatialOffsetPosition(this.hand, grabbableData.spatialKey);
|
|
||||||
this.offsetRotation = getSpatialOffsetRotation(this.hand, grabbableData.spatialKey);
|
|
||||||
} else {
|
|
||||||
this.ignoreIK = false;
|
|
||||||
|
|
||||||
var objectRotation = grabbedProperties.rotation;
|
|
||||||
this.offsetRotation = Quat.multiply(Quat.inverse(handRotation), objectRotation);
|
|
||||||
|
|
||||||
var currentObjectPosition = grabbedProperties.position;
|
|
||||||
var offset = Vec3.subtract(currentObjectPosition, handPosition);
|
|
||||||
this.offsetPosition = Vec3.multiplyQbyV(Quat.inverse(Quat.multiply(handRotation, this.offsetRotation)), offset);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!this.setupHoldAction()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this.state == STATE_NEAR_GRABBING) {
|
|
||||||
this.setState(STATE_CONTINUE_NEAR_GRABBING);
|
|
||||||
} else {
|
|
||||||
// equipping
|
|
||||||
Entities.callEntityMethod(this.grabbedEntity, "startEquip", [JSON.stringify(this.hand)]);
|
|
||||||
this.startHandGrasp();
|
|
||||||
|
|
||||||
this.setState(STATE_CONTINUE_EQUIP_BD);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this.hand === RIGHT_HAND) {
|
|
||||||
Entities.callEntityMethod(this.grabbedEntity, "setRightHand");
|
|
||||||
} else {
|
|
||||||
Entities.callEntityMethod(this.grabbedEntity, "setLeftHand");
|
|
||||||
}
|
|
||||||
|
|
||||||
Entities.callEntityMethod(this.grabbedEntity, "setHand", [this.hand]);
|
|
||||||
Entities.callEntityMethod(this.grabbedEntity, "startNearGrab");
|
|
||||||
|
|
||||||
this.currentHandControllerTipPosition =
|
|
||||||
(this.hand === RIGHT_HAND) ? MyAvatar.rightHandTipPosition : MyAvatar.leftHandTipPosition;
|
|
||||||
|
|
||||||
this.currentObjectTime = Date.now();
|
|
||||||
};
|
|
||||||
|
|
||||||
this.continueNearGrabbing = function() {
|
this.continueNearGrabbing = function() {
|
||||||
if (this.state == STATE_CONTINUE_NEAR_GRABBING && this.triggerSmoothedReleased()) {
|
if (this.state == STATE_CONTINUE_NEAR_GRABBING && this.triggerSmoothedReleased()) {
|
||||||
|
@ -1979,8 +1992,8 @@ Script.update.connect(update);
|
||||||
// we can't create the search system on-demand since it takes some time for the particles to reach their entire length.
|
// we can't create the search system on-demand since it takes some time for the particles to reach their entire length.
|
||||||
// thus the system cannot have a fixed lifetime. this loop updates the lifetimes and will stop updating if a user crashes.
|
// thus the system cannot have a fixed lifetime. this loop updates the lifetimes and will stop updating if a user crashes.
|
||||||
|
|
||||||
if(USE_PARTICLE_BEAM_FOR_SEARCHING===true || USE_PARTICLE_BEAM_FOR_MOVING ===true){
|
if (USE_PARTICLE_BEAM_FOR_SEARCHING === true || USE_PARTICLE_BEAM_FOR_MOVING === true) {
|
||||||
Script.update.connect(renewParticleBeamLifetimes)
|
Script.update.connect(renewParticleBeamLifetimes)
|
||||||
}
|
}
|
||||||
|
|
||||||
var sinceLastParticleLifetimeUpdate = 0;
|
var sinceLastParticleLifetimeUpdate = 0;
|
||||||
|
@ -1995,4 +2008,4 @@ function renewParticleBeamLifetimes(deltaTime) {
|
||||||
}
|
}
|
||||||
rightController.renewParticleBeamLifetime();
|
rightController.renewParticleBeamLifetime();
|
||||||
leftController.renewParticleBeamLifetime();
|
leftController.renewParticleBeamLifetime();
|
||||||
}
|
}
|
|
@ -16,5 +16,12 @@
|
||||||
|
|
||||||
this.collisionWithEntity = function(myID, otherID, collisionInfo) {
|
this.collisionWithEntity = function(myID, otherID, collisionInfo) {
|
||||||
Entities.editEntity(myID, { color: { red: getRandomInt(128,255), green: getRandomInt(128,255), blue: getRandomInt(128,255)} });
|
Entities.editEntity(myID, { color: { red: getRandomInt(128,255), green: getRandomInt(128,255), blue: getRandomInt(128,255)} });
|
||||||
|
print("collisionWithEntity() myID:" + myID + ", otherID:" + otherID);
|
||||||
|
print(" collisionInfo.type:" + collisionInfo.type);
|
||||||
|
print(" collisionInfo.idA:" + collisionInfo.idA);
|
||||||
|
print(" collisionInfo.idB:" + collisionInfo.idB);
|
||||||
|
Vec3.print(" collisionInfo.penetration:", collisionInfo.penetration);
|
||||||
|
Vec3.print(" collisionInfo.contactPoint:", collisionInfo.contactPoint);
|
||||||
|
Vec3.print(" collisionInfo.velocityChange:", collisionInfo.velocityChange);
|
||||||
};
|
};
|
||||||
})
|
})
|
|
@ -309,7 +309,7 @@ Grabber.prototype.computeNewGrabPlane = function() {
|
||||||
}
|
}
|
||||||
|
|
||||||
Grabber.prototype.pressEvent = function(event) {
|
Grabber.prototype.pressEvent = function(event) {
|
||||||
if (!event.isLeftButton) {
|
if (event.isLeftButton!==true ||event.isRightButton===true || event.isMiddleButton===true) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -374,7 +374,11 @@ Grabber.prototype.pressEvent = function(event) {
|
||||||
//Audio.playSound(grabSound, { position: entityProperties.position, volume: VOLUME });
|
//Audio.playSound(grabSound, { position: entityProperties.position, volume: VOLUME });
|
||||||
}
|
}
|
||||||
|
|
||||||
Grabber.prototype.releaseEvent = function() {
|
Grabber.prototype.releaseEvent = function(event) {
|
||||||
|
if (event.isLeftButton!==true ||event.isRightButton===true || event.isMiddleButton===true) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (this.isGrabbing) {
|
if (this.isGrabbing) {
|
||||||
this.deactivateEntity(this.entityID);
|
this.deactivateEntity(this.entityID);
|
||||||
this.isGrabbing = false
|
this.isGrabbing = false
|
||||||
|
|
|
@ -64,7 +64,7 @@ const float MIN_AVATAR_SPEED = 0.05f; // speed is set to zero below this
|
||||||
|
|
||||||
// TODO: normalize avatar speed for standard avatar size, then scale all motion logic
|
// TODO: normalize avatar speed for standard avatar size, then scale all motion logic
|
||||||
// to properly follow avatar size.
|
// to properly follow avatar size.
|
||||||
float MAX_AVATAR_SPEED = 300.0f;
|
float MAX_AVATAR_SPEED = 30.0f;
|
||||||
float MAX_KEYBOARD_MOTOR_SPEED = MAX_AVATAR_SPEED;
|
float MAX_KEYBOARD_MOTOR_SPEED = MAX_AVATAR_SPEED;
|
||||||
float DEFAULT_KEYBOARD_MOTOR_TIMESCALE = 0.25f;
|
float DEFAULT_KEYBOARD_MOTOR_TIMESCALE = 0.25f;
|
||||||
float MIN_SCRIPTED_MOTOR_TIMESCALE = 0.005f;
|
float MIN_SCRIPTED_MOTOR_TIMESCALE = 0.005f;
|
||||||
|
|
|
@ -717,11 +717,11 @@ void EntityTreeRenderer::checkAndCallPreload(const EntityItemID& entityID, const
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void EntityTreeRenderer::playEntityCollisionSound(const QUuid& myNodeID, EntityTreePointer entityTree,
|
bool EntityTreeRenderer::isCollisionOwner(const QUuid& myNodeID, EntityTreePointer entityTree,
|
||||||
const EntityItemID& id, const Collision& collision) {
|
const EntityItemID& id, const Collision& collision) {
|
||||||
EntityItemPointer entity = entityTree->findEntityByEntityItemID(id);
|
EntityItemPointer entity = entityTree->findEntityByEntityItemID(id);
|
||||||
if (!entity) {
|
if (!entity) {
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
QUuid simulatorID = entity->getSimulatorID();
|
QUuid simulatorID = entity->getSimulatorID();
|
||||||
if (simulatorID.isNull()) {
|
if (simulatorID.isNull()) {
|
||||||
|
@ -730,14 +730,30 @@ void EntityTreeRenderer::playEntityCollisionSound(const QUuid& myNodeID, EntityT
|
||||||
const EntityItemID& otherID = (id == collision.idA) ? collision.idB : collision.idA;
|
const EntityItemID& otherID = (id == collision.idA) ? collision.idB : collision.idA;
|
||||||
EntityItemPointer otherEntity = entityTree->findEntityByEntityItemID(otherID);
|
EntityItemPointer otherEntity = entityTree->findEntityByEntityItemID(otherID);
|
||||||
if (!otherEntity) {
|
if (!otherEntity) {
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
simulatorID = otherEntity->getSimulatorID();
|
simulatorID = otherEntity->getSimulatorID();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (simulatorID.isNull() || (simulatorID != myNodeID)) {
|
if (simulatorID.isNull() || (simulatorID != myNodeID)) {
|
||||||
return; // Only one injector per simulation, please.
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void EntityTreeRenderer::playEntityCollisionSound(const QUuid& myNodeID, EntityTreePointer entityTree,
|
||||||
|
const EntityItemID& id, const Collision& collision) {
|
||||||
|
|
||||||
|
if (!isCollisionOwner(myNodeID, entityTree, id, collision)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
EntityItemPointer entity = entityTree->findEntityByEntityItemID(id);
|
||||||
|
if (!entity) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const QString& collisionSoundURL = entity->getCollisionSoundURL();
|
const QString& collisionSoundURL = entity->getCollisionSoundURL();
|
||||||
if (collisionSoundURL.isEmpty()) {
|
if (collisionSoundURL.isEmpty()) {
|
||||||
return;
|
return;
|
||||||
|
@ -796,10 +812,15 @@ void EntityTreeRenderer::entityCollisionWithEntity(const EntityItemID& idA, cons
|
||||||
playEntityCollisionSound(myNodeID, entityTree, idB, collision);
|
playEntityCollisionSound(myNodeID, entityTree, idB, collision);
|
||||||
|
|
||||||
// And now the entity scripts
|
// And now the entity scripts
|
||||||
emit collisionWithEntity(idA, idB, collision);
|
if (isCollisionOwner(myNodeID, entityTree, idA, collision)) {
|
||||||
_entitiesScriptEngine->callEntityScriptMethod(idA, "collisionWithEntity", idB, collision);
|
emit collisionWithEntity(idA, idB, collision);
|
||||||
emit collisionWithEntity(idB, idA, collision);
|
_entitiesScriptEngine->callEntityScriptMethod(idA, "collisionWithEntity", idB, collision);
|
||||||
_entitiesScriptEngine->callEntityScriptMethod(idB, "collisionWithEntity", idA, collision);
|
}
|
||||||
|
|
||||||
|
if (isCollisionOwner(myNodeID, entityTree, idA, collision)) {
|
||||||
|
emit collisionWithEntity(idB, idA, collision);
|
||||||
|
_entitiesScriptEngine->callEntityScriptMethod(idB, "collisionWithEntity", idA, collision);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void EntityTreeRenderer::updateEntityRenderStatus(bool shouldRenderEntities) {
|
void EntityTreeRenderer::updateEntityRenderStatus(bool shouldRenderEntities) {
|
||||||
|
|
|
@ -148,6 +148,9 @@ private:
|
||||||
bool _wantScripts;
|
bool _wantScripts;
|
||||||
ScriptEngine* _entitiesScriptEngine;
|
ScriptEngine* _entitiesScriptEngine;
|
||||||
|
|
||||||
|
bool isCollisionOwner(const QUuid& myNodeID, EntityTreePointer entityTree,
|
||||||
|
const EntityItemID& id, const Collision& collision);
|
||||||
|
|
||||||
void playEntityCollisionSound(const QUuid& myNodeID, EntityTreePointer entityTree,
|
void playEntityCollisionSound(const QUuid& myNodeID, EntityTreePointer entityTree,
|
||||||
const EntityItemID& id, const Collision& collision);
|
const EntityItemID& id, const Collision& collision);
|
||||||
|
|
||||||
|
|
|
@ -41,7 +41,7 @@ PacketVersion versionForPacketType(PacketType packetType) {
|
||||||
case PacketType::EntityAdd:
|
case PacketType::EntityAdd:
|
||||||
case PacketType::EntityEdit:
|
case PacketType::EntityEdit:
|
||||||
case PacketType::EntityData:
|
case PacketType::EntityData:
|
||||||
return VERSION_MODEL_ENTITIES_JOINTS_ON_WIRE;
|
return VERSION_ENTITITES_HAVE_QUERY_BOX;
|
||||||
case PacketType::AvatarData:
|
case PacketType::AvatarData:
|
||||||
case PacketType::BulkAvatarData:
|
case PacketType::BulkAvatarData:
|
||||||
return static_cast<PacketVersion>(AvatarMixerPacketVersion::SoftAttachmentSupport);
|
return static_cast<PacketVersion>(AvatarMixerPacketVersion::SoftAttachmentSupport);
|
||||||
|
|
|
@ -699,7 +699,7 @@ int OctreePacketData::unpackDataFromBytes(const unsigned char *dataBytes, QVecto
|
||||||
dataBytes += unpackOrientationQuatFromBytes(dataBytes, result[i]);
|
dataBytes += unpackOrientationQuatFromBytes(dataBytes, result[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (dataBytes - start) + sizeof(uint16_t);
|
return (dataBytes - start) + (int)sizeof(uint16_t);
|
||||||
}
|
}
|
||||||
|
|
||||||
int OctreePacketData::unpackDataFromBytes(const unsigned char* dataBytes, QVector<float>& result) {
|
int OctreePacketData::unpackDataFromBytes(const unsigned char* dataBytes, QVector<float>& result) {
|
||||||
|
@ -728,7 +728,7 @@ int OctreePacketData::unpackDataFromBytes(const unsigned char* dataBytes, QVecto
|
||||||
bit = (bit + 1) % BITS_IN_BYTE;
|
bit = (bit + 1) % BITS_IN_BYTE;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (dataBytes - start) + sizeof(uint16_t);
|
return (dataBytes - start) + (int)sizeof(uint16_t);
|
||||||
}
|
}
|
||||||
|
|
||||||
int OctreePacketData::unpackDataFromBytes(const unsigned char* dataBytes, QByteArray& result) {
|
int OctreePacketData::unpackDataFromBytes(const unsigned char* dataBytes, QByteArray& result) {
|
||||||
|
|
Loading…
Reference in a new issue