mirror of
https://github.com/overte-org/overte.git
synced 2025-08-07 03:50:16 +02:00
Merge pull request #14731 from AndrewMeadows/fix-mexico-hats
cases 20709 and 20715: wear and see mexico hats
This commit is contained in:
commit
3776472550
6 changed files with 26 additions and 17 deletions
|
@ -767,7 +767,7 @@ void MyAvatar::simulate(float deltaTime, bool inView) {
|
||||||
auto headBoneSet = _skeletonModel->getCauterizeBoneSet();
|
auto headBoneSet = _skeletonModel->getCauterizeBoneSet();
|
||||||
forEachChild([&](SpatiallyNestablePointer object) {
|
forEachChild([&](SpatiallyNestablePointer object) {
|
||||||
bool isChildOfHead = headBoneSet.find(object->getParentJointIndex()) != headBoneSet.end();
|
bool isChildOfHead = headBoneSet.find(object->getParentJointIndex()) != headBoneSet.end();
|
||||||
if (isChildOfHead) {
|
if (isChildOfHead && !object->hasGrabs()) {
|
||||||
// Cauterize or display children of head per head drawing state.
|
// Cauterize or display children of head per head drawing state.
|
||||||
updateChildCauterization(object, !_prevShouldDrawHead);
|
updateChildCauterization(object, !_prevShouldDrawHead);
|
||||||
object->forEachDescendant([&](SpatiallyNestablePointer descendant) {
|
object->forEachDescendant([&](SpatiallyNestablePointer descendant) {
|
||||||
|
@ -817,7 +817,9 @@ void MyAvatar::simulate(float deltaTime, bool inView) {
|
||||||
// and all of its joints, now update our attachements.
|
// and all of its joints, now update our attachements.
|
||||||
Avatar::simulateAttachments(deltaTime);
|
Avatar::simulateAttachments(deltaTime);
|
||||||
relayJointDataToChildren();
|
relayJointDataToChildren();
|
||||||
updateGrabs();
|
if (updateGrabs()) {
|
||||||
|
_cauterizationNeedsUpdate = true;
|
||||||
|
}
|
||||||
|
|
||||||
if (!_skeletonModel->hasSkeleton()) {
|
if (!_skeletonModel->hasSkeleton()) {
|
||||||
// All the simulation that can be done has been done
|
// All the simulation that can be done has been done
|
||||||
|
|
|
@ -324,8 +324,8 @@ void Avatar::removeAvatarEntitiesFromTree() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Avatar::updateGrabs() {
|
bool Avatar::updateGrabs() {
|
||||||
|
bool grabAddedOrRemoved = false;
|
||||||
// update the Grabs according to any changes in _avatarGrabData
|
// update the Grabs according to any changes in _avatarGrabData
|
||||||
_avatarGrabsLock.withWriteLock([&] {
|
_avatarGrabsLock.withWriteLock([&] {
|
||||||
if (_avatarGrabDataChanged) {
|
if (_avatarGrabDataChanged) {
|
||||||
|
@ -385,6 +385,7 @@ void Avatar::updateGrabs() {
|
||||||
entityTree->updateEntityQueryAACube(target, packetSender, force, iShouldTellServer);
|
entityTree->updateEntityQueryAACube(target, packetSender, force, iShouldTellServer);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
grabAddedOrRemoved = true;
|
||||||
}
|
}
|
||||||
_avatarGrabs.remove(grabID);
|
_avatarGrabs.remove(grabID);
|
||||||
_changedAvatarGrabs.remove(grabID);
|
_changedAvatarGrabs.remove(grabID);
|
||||||
|
@ -402,9 +403,11 @@ void Avatar::updateGrabs() {
|
||||||
target->addGrab(grab);
|
target->addGrab(grab);
|
||||||
// only clear this entry from the _changedAvatarGrabs if we found the entity.
|
// only clear this entry from the _changedAvatarGrabs if we found the entity.
|
||||||
changeItr.remove();
|
changeItr.remove();
|
||||||
|
grabAddedOrRemoved = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
return grabAddedOrRemoved;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Avatar::accumulateGrabPositions(std::map<QUuid, GrabLocationAccumulator>& grabAccumulators) {
|
void Avatar::accumulateGrabPositions(std::map<QUuid, GrabLocationAccumulator>& grabAccumulators) {
|
||||||
|
|
|
@ -538,7 +538,7 @@ protected:
|
||||||
|
|
||||||
// protected methods...
|
// protected methods...
|
||||||
bool isLookingAtMe(AvatarSharedPointer avatar) const;
|
bool isLookingAtMe(AvatarSharedPointer avatar) const;
|
||||||
void updateGrabs();
|
bool updateGrabs();
|
||||||
void relayJointDataToChildren();
|
void relayJointDataToChildren();
|
||||||
|
|
||||||
void fade(render::Transaction& transaction, render::Transition::Type type);
|
void fade(render::Transaction& transaction, render::Transition::Type type);
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
Entities, enableDispatcherModule, disableDispatcherModule, entityIsGrabbable, makeDispatcherModuleParameters, MSECS_PER_SEC,
|
Entities, enableDispatcherModule, disableDispatcherModule, entityIsGrabbable, makeDispatcherModuleParameters, MSECS_PER_SEC,
|
||||||
HAPTIC_PULSE_STRENGTH, HAPTIC_PULSE_DURATION, TRIGGER_OFF_VALUE, TRIGGER_ON_VALUE, ZERO_VEC,
|
HAPTIC_PULSE_STRENGTH, HAPTIC_PULSE_DURATION, TRIGGER_OFF_VALUE, TRIGGER_ON_VALUE, ZERO_VEC,
|
||||||
projectOntoEntityXYPlane, ContextOverlay, HMD, Picks, makeLaserLockInfo, makeLaserParams, AddressManager,
|
projectOntoEntityXYPlane, ContextOverlay, HMD, Picks, makeLaserLockInfo, makeLaserParams, AddressManager,
|
||||||
getEntityParents, Selection, DISPATCHER_HOVERING_LIST, unhighlightTargetEntity, Messages, findGroupParent,
|
getEntityParents, Selection, DISPATCHER_HOVERING_LIST, unhighlightTargetEntity, Messages, findGrabbableGroupParent,
|
||||||
worldPositionToRegistrationFrameMatrix, DISPATCHER_PROPERTIES
|
worldPositionToRegistrationFrameMatrix, DISPATCHER_PROPERTIES
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -308,7 +308,7 @@ Script.include("/~/system/libraries/controllers.js");
|
||||||
var gtProps = Entities.getEntityProperties(targetEntity, DISPATCHER_PROPERTIES);
|
var gtProps = Entities.getEntityProperties(targetEntity, DISPATCHER_PROPERTIES);
|
||||||
if (entityIsGrabbable(gtProps)) {
|
if (entityIsGrabbable(gtProps)) {
|
||||||
// if we've attempted to grab a child, roll up to the root of the tree
|
// if we've attempted to grab a child, roll up to the root of the tree
|
||||||
var groupRootProps = findGroupParent(controllerData, gtProps);
|
var groupRootProps = findGrabbableGroupParent(controllerData, gtProps);
|
||||||
if (entityIsGrabbable(groupRootProps)) {
|
if (entityIsGrabbable(groupRootProps)) {
|
||||||
return groupRootProps;
|
return groupRootProps;
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,9 +8,10 @@
|
||||||
|
|
||||||
/* global Script, Entities, MyAvatar, Controller, RIGHT_HAND, LEFT_HAND, getControllerJointIndex, enableDispatcherModule,
|
/* global Script, Entities, MyAvatar, Controller, RIGHT_HAND, LEFT_HAND, getControllerJointIndex, enableDispatcherModule,
|
||||||
disableDispatcherModule, Messages, HAPTIC_PULSE_STRENGTH, HAPTIC_PULSE_DURATION, TRIGGER_OFF_VALUE,
|
disableDispatcherModule, Messages, HAPTIC_PULSE_STRENGTH, HAPTIC_PULSE_DURATION, TRIGGER_OFF_VALUE,
|
||||||
makeDispatcherModuleParameters, entityIsGrabbable, makeRunningValues, NEAR_GRAB_RADIUS, findGroupParent, Vec3, cloneEntity,
|
makeDispatcherModuleParameters, entityIsGrabbable, makeRunningValues, NEAR_GRAB_RADIUS, findGrabbableGroupParent, Vec3,
|
||||||
entityIsCloneable, HAPTIC_PULSE_STRENGTH, HAPTIC_PULSE_DURATION, BUMPER_ON_VALUE, distanceBetweenPointAndEntityBoundingBox,
|
cloneEntity, entityIsCloneable, HAPTIC_PULSE_STRENGTH, HAPTIC_PULSE_DURATION, BUMPER_ON_VALUE,
|
||||||
getGrabbableData, getEnabledModuleByName, DISPATCHER_PROPERTIES, HMD, NEAR_GRAB_DISTANCE
|
distanceBetweenPointAndEntityBoundingBox, getGrabbableData, getEnabledModuleByName, DISPATCHER_PROPERTIES, HMD,
|
||||||
|
NEAR_GRAB_DISTANCE
|
||||||
*/
|
*/
|
||||||
|
|
||||||
Script.include("/~/system/libraries/controllerDispatcherUtils.js");
|
Script.include("/~/system/libraries/controllerDispatcherUtils.js");
|
||||||
|
@ -80,9 +81,6 @@ Script.include("/~/system/libraries/controllers.js");
|
||||||
this.endNearGrabEntity = function () {
|
this.endNearGrabEntity = function () {
|
||||||
this.endGrab();
|
this.endGrab();
|
||||||
|
|
||||||
this.grabbing = false;
|
|
||||||
this.targetEntityID = null;
|
|
||||||
|
|
||||||
var args = [this.hand === RIGHT_HAND ? "right" : "left", MyAvatar.sessionUUID];
|
var args = [this.hand === RIGHT_HAND ? "right" : "left", MyAvatar.sessionUUID];
|
||||||
Entities.callEntityMethod(this.targetEntityID, "releaseGrab", args);
|
Entities.callEntityMethod(this.targetEntityID, "releaseGrab", args);
|
||||||
Messages.sendMessage('Hifi-Object-Manipulation', JSON.stringify({
|
Messages.sendMessage('Hifi-Object-Manipulation', JSON.stringify({
|
||||||
|
@ -90,6 +88,9 @@ Script.include("/~/system/libraries/controllers.js");
|
||||||
grabbedEntity: this.targetEntityID,
|
grabbedEntity: this.targetEntityID,
|
||||||
joint: this.hand === RIGHT_HAND ? "RightHand" : "LeftHand"
|
joint: this.hand === RIGHT_HAND ? "RightHand" : "LeftHand"
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
this.grabbing = false;
|
||||||
|
this.targetEntityID = null;
|
||||||
};
|
};
|
||||||
|
|
||||||
this.getTargetProps = function (controllerData) {
|
this.getTargetProps = function (controllerData) {
|
||||||
|
@ -110,7 +111,7 @@ Script.include("/~/system/libraries/controllers.js");
|
||||||
if (entityIsGrabbable(props) || entityIsCloneable(props)) {
|
if (entityIsGrabbable(props) || entityIsCloneable(props)) {
|
||||||
if (!entityIsCloneable(props)) {
|
if (!entityIsCloneable(props)) {
|
||||||
// if we've attempted to grab a non-cloneable child, roll up to the root of the tree
|
// if we've attempted to grab a non-cloneable child, roll up to the root of the tree
|
||||||
var groupRootProps = findGroupParent(controllerData, props);
|
var groupRootProps = findGrabbableGroupParent(controllerData, props);
|
||||||
if (entityIsGrabbable(groupRootProps)) {
|
if (entityIsGrabbable(groupRootProps)) {
|
||||||
return groupRootProps;
|
return groupRootProps;
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,7 +47,7 @@
|
||||||
makeLaserLockInfo:true,
|
makeLaserLockInfo:true,
|
||||||
entityHasActions:true,
|
entityHasActions:true,
|
||||||
ensureDynamic:true,
|
ensureDynamic:true,
|
||||||
findGroupParent:true,
|
findGrabbableGroupParent:true,
|
||||||
BUMPER_ON_VALUE:true,
|
BUMPER_ON_VALUE:true,
|
||||||
getEntityParents:true,
|
getEntityParents:true,
|
||||||
findHandChildEntities:true,
|
findHandChildEntities:true,
|
||||||
|
@ -451,7 +451,7 @@ ensureDynamic = function (entityID) {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
findGroupParent = function (controllerData, targetProps) {
|
findGrabbableGroupParent = function (controllerData, targetProps) {
|
||||||
while (targetProps.grab.grabDelegateToParent &&
|
while (targetProps.grab.grabDelegateToParent &&
|
||||||
targetProps.parentID &&
|
targetProps.parentID &&
|
||||||
targetProps.parentID !== Uuid.NULL &&
|
targetProps.parentID !== Uuid.NULL &&
|
||||||
|
@ -460,6 +460,9 @@ findGroupParent = function (controllerData, targetProps) {
|
||||||
if (!parentProps) {
|
if (!parentProps) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
if (!entityIsGrabbable(parentProps)) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
parentProps.id = targetProps.parentID;
|
parentProps.id = targetProps.parentID;
|
||||||
targetProps = parentProps;
|
targetProps = parentProps;
|
||||||
controllerData.nearbyEntityPropertiesByID[targetProps.id] = targetProps;
|
controllerData.nearbyEntityPropertiesByID[targetProps.id] = targetProps;
|
||||||
|
@ -605,7 +608,7 @@ if (typeof module !== 'undefined') {
|
||||||
unhighlightTargetEntity: unhighlightTargetEntity,
|
unhighlightTargetEntity: unhighlightTargetEntity,
|
||||||
clearHighlightedEntities: clearHighlightedEntities,
|
clearHighlightedEntities: clearHighlightedEntities,
|
||||||
makeRunningValues: makeRunningValues,
|
makeRunningValues: makeRunningValues,
|
||||||
findGroupParent: findGroupParent,
|
findGrabbableGroupParent: findGrabbableGroupParent,
|
||||||
LEFT_HAND: LEFT_HAND,
|
LEFT_HAND: LEFT_HAND,
|
||||||
RIGHT_HAND: RIGHT_HAND,
|
RIGHT_HAND: RIGHT_HAND,
|
||||||
BUMPER_ON_VALUE: BUMPER_ON_VALUE,
|
BUMPER_ON_VALUE: BUMPER_ON_VALUE,
|
||||||
|
|
Loading…
Reference in a new issue