diff --git a/android/app/build.gradle b/android/app/build.gradle index 3537df033d..980d197397 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -4,7 +4,7 @@ android { compileSdkVersion 26 //buildToolsVersion '27.0.3' - def appVersionCode = Integer.valueOf(RELEASE_NUMBER ?: 1) + def appVersionCode = Integer.valueOf(VERSION_CODE ?: 1) def appVersionName = RELEASE_NUMBER ?: "1.0" defaultConfig { diff --git a/android/build.gradle b/android/build.gradle index 373569ca77..39265327b2 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -37,6 +37,7 @@ task clean(type: Delete) { ext { RELEASE_NUMBER = project.hasProperty('RELEASE_NUMBER') ? project.getProperty('RELEASE_NUMBER') : '0' + VERSION_CODE = project.hasProperty('VERSION_CODE') ? project.getProperty('VERSION_CODE') : '0' RELEASE_TYPE = project.hasProperty('RELEASE_TYPE') ? project.getProperty('RELEASE_TYPE') : 'DEV' STABLE_BUILD = project.hasProperty('STABLE_BUILD') ? project.getProperty('STABLE_BUILD') : '0' EXEC_SUFFIX = Os.isFamily(Os.FAMILY_WINDOWS) ? '.exe' : '' diff --git a/assignment-client/src/scripts/EntityScriptServer.cpp b/assignment-client/src/scripts/EntityScriptServer.cpp index 607ab28b20..326628da64 100644 --- a/assignment-client/src/scripts/EntityScriptServer.cpp +++ b/assignment-client/src/scripts/EntityScriptServer.cpp @@ -69,9 +69,6 @@ EntityScriptServer::EntityScriptServer(ReceivedMessage& message) : ThreadedAssig DependencyManager::set(); DependencyManager::set(); - DependencyManager::set(ScriptEngine::ENTITY_SERVER_SCRIPT); - - DependencyManager::set(); // Needed to ensure the creation of the DebugDraw instance on the main thread @@ -254,6 +251,9 @@ void EntityScriptServer::handleEntityScriptCallMethodPacket(QSharedPointer(ScriptEngine::ENTITY_SERVER_SCRIPT); + DependencyManager::set(); + // make sure we request our script once the agent connects to the domain auto nodeList = DependencyManager::get(); diff --git a/domain-server/src/DomainGatekeeper.cpp b/domain-server/src/DomainGatekeeper.cpp index 2a6b78744e..59cc8d10f6 100644 --- a/domain-server/src/DomainGatekeeper.cpp +++ b/domain-server/src/DomainGatekeeper.cpp @@ -412,7 +412,7 @@ SharedNodePointer DomainGatekeeper::processAgentConnectRequest(const NodeConnect } else if (verifyUserSignature(username, usernameSignature, nodeConnection.senderSockAddr)) { // they sent us a username and the signature verifies it getGroupMemberships(username); - verifiedUsername = username; + verifiedUsername = username.toLower(); } else { // they sent us a username, but it didn't check out requestUserPublicKey(username); @@ -993,7 +993,7 @@ void DomainGatekeeper::getDomainOwnerFriendsListJSONCallback(QNetworkReply* requ _domainOwnerFriends.clear(); QJsonArray friends = jsonObject["data"].toObject()["friends"].toArray(); for (int i = 0; i < friends.size(); i++) { - _domainOwnerFriends += friends.at(i).toString(); + _domainOwnerFriends += friends.at(i).toString().toLower(); } } else { qDebug() << "getDomainOwnerFriendsList api call returned:" << QJsonDocument(jsonObject).toJson(QJsonDocument::Compact); diff --git a/interface/resources/html/img/tablet-help-keyboard.jpg b/interface/resources/html/img/tablet-help-keyboard.jpg index d0f84c17c7..1c257f83e2 100644 Binary files a/interface/resources/html/img/tablet-help-keyboard.jpg and b/interface/resources/html/img/tablet-help-keyboard.jpg differ diff --git a/interface/resources/qml/hifi/tablet/ControllerSettings.qml b/interface/resources/qml/hifi/tablet/ControllerSettings.qml index 4ad37b7bc8..92b750fa7a 100644 --- a/interface/resources/qml/hifi/tablet/ControllerSettings.qml +++ b/interface/resources/qml/hifi/tablet/ControllerSettings.qml @@ -69,6 +69,7 @@ Item { id: stack initialItem: inputConfiguration property alias messageVisible: imageMessageBox.visible + property string selectedPlugin: "" Rectangle { id: inputConfiguration anchors { @@ -274,6 +275,8 @@ Item { } else { box.label = ""; } + + stack.selectedPlugin = selectedDevice; } Timer { diff --git a/interface/resources/qml/hifi/tablet/OpenVrConfiguration.qml b/interface/resources/qml/hifi/tablet/OpenVrConfiguration.qml index 20682372c5..c2aff08e35 100644 --- a/interface/resources/qml/hifi/tablet/OpenVrConfiguration.qml +++ b/interface/resources/qml/hifi/tablet/OpenVrConfiguration.qml @@ -28,6 +28,7 @@ Flickable { onPluginNameChanged: { if (page !== null) { page.pluginName = flick.pluginName; + page.displayConfiguration(); } } diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index dc091f3809..cbe0212a0b 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -6928,7 +6928,9 @@ void Application::showAssetServerWidget(QString filePath) { DependencyManager::get()->show(url, "AssetServer", startUpload); } else { static const QUrl url("hifi/dialogs/TabletAssetServer.qml"); - tablet->pushOntoStack(url); + if (!tablet->isPathLoaded(url)) { + tablet->pushOntoStack(url); + } } } diff --git a/interface/src/Menu.cpp b/interface/src/Menu.cpp index fcf7b53536..646067169f 100644 --- a/interface/src/Menu.cpp +++ b/interface/src/Menu.cpp @@ -256,8 +256,6 @@ Menu::Menu() { addCheckableActionToQMenuAndActionHash(viewMenu, MenuOption::CenterPlayerInView, 0, true, qApp, SLOT(rotationModeChanged())); - addCheckableActionToQMenuAndActionHash(viewMenu, MenuOption::Overlays, 0, true); - // View > Enter First Person Mode in HMD addCheckableActionToQMenuAndActionHash(viewMenu, MenuOption::FirstPersonHMD, 0, true); @@ -818,6 +816,9 @@ Menu::Menu() { addCheckableActionToQMenuAndActionHash(developerMenu, MenuOption::VerboseLogging, 0, false, qApp, SLOT(updateVerboseLogging())); + // Developer > Show Overlays + addCheckableActionToQMenuAndActionHash(developerMenu, MenuOption::Overlays, 0, true); + #if 0 /// -------------- REMOVED FOR NOW -------------- addDisabledActionAndSeparator(navigateMenu, "History"); QAction* backAction = addActionToQMenuAndActionHash(navigateMenu, MenuOption::Back, 0, addressManager.data(), SLOT(goBack())); diff --git a/interface/src/avatar/MyAvatar.cpp b/interface/src/avatar/MyAvatar.cpp index ed7ce87db2..b08496c2b8 100755 --- a/interface/src/avatar/MyAvatar.cpp +++ b/interface/src/avatar/MyAvatar.cpp @@ -3348,7 +3348,7 @@ void MyAvatar::FollowHelper::prePhysicsUpdate(MyAvatar& myAvatar, const glm::mat if (!isActive(Rotation) && (shouldActivateRotation(myAvatar, desiredBodyMatrix, currentBodyMatrix) || hasDriveInput)) { activate(Rotation); } - if (!isActive(Horizontal) && shouldActivateHorizontal(myAvatar, desiredBodyMatrix, currentBodyMatrix)) { + if (!isActive(Horizontal) && (shouldActivateHorizontal(myAvatar, desiredBodyMatrix, currentBodyMatrix) || hasDriveInput)) { activate(Horizontal); } if (!isActive(Vertical) && (shouldActivateVertical(myAvatar, desiredBodyMatrix, currentBodyMatrix) || hasDriveInput)) { diff --git a/interface/src/avatar/MySkeletonModel.cpp b/interface/src/avatar/MySkeletonModel.cpp index c15b00ca19..0fc5e7521e 100644 --- a/interface/src/avatar/MySkeletonModel.cpp +++ b/interface/src/avatar/MySkeletonModel.cpp @@ -46,7 +46,7 @@ static AnimPose computeHipsInSensorFrame(MyAvatar* myAvatar, bool isFlying) { } glm::mat4 hipsMat; - if (myAvatar->getCenterOfGravityModelEnabled()) { + if (myAvatar->getCenterOfGravityModelEnabled() && !isFlying) { // then we use center of gravity model hipsMat = myAvatar->deriveBodyUsingCgModel(); } else { @@ -109,6 +109,11 @@ void MySkeletonModel::updateRig(float deltaTime, glm::mat4 parentTransform) { AnimPose avatarToRigPose(glm::vec3(1.0f), Quaternions::Y_180, glm::vec3(0.0f)); + glm::mat4 rigToAvatarMatrix = Matrices::Y_180; + glm::mat4 avatarToWorldMatrix = createMatFromQuatAndPos(myAvatar->getWorldOrientation(), myAvatar->getWorldPosition()); + glm::mat4 sensorToWorldMatrix = myAvatar->getSensorToWorldMatrix(); + params.rigToSensorMatrix = glm::inverse(sensorToWorldMatrix) * avatarToWorldMatrix * rigToAvatarMatrix; + // input action is the highest priority source for head orientation. auto avatarHeadPose = myAvatar->getControllerPoseInAvatarFrame(controller::Action::HEAD); if (avatarHeadPose.isValid()) { diff --git a/libraries/animation/src/Rig.cpp b/libraries/animation/src/Rig.cpp index 0833b28142..40516a3d7c 100644 --- a/libraries/animation/src/Rig.cpp +++ b/libraries/animation/src/Rig.cpp @@ -1244,7 +1244,8 @@ void Rig::updateHands(bool leftHandEnabled, bool rightHandEnabled, bool hipsEnab bool leftArmEnabled, bool rightArmEnabled, float dt, const AnimPose& leftHandPose, const AnimPose& rightHandPose, const FBXJointShapeInfo& hipsShapeInfo, const FBXJointShapeInfo& spineShapeInfo, - const FBXJointShapeInfo& spine1ShapeInfo, const FBXJointShapeInfo& spine2ShapeInfo) { + const FBXJointShapeInfo& spine1ShapeInfo, const FBXJointShapeInfo& spine2ShapeInfo, + const glm::mat4& rigToSensorMatrix, const glm::mat4& sensorToRigMatrix) { const bool ENABLE_POLE_VECTORS = false; const float ELBOW_POLE_VECTOR_BLEND_FACTOR = 0.95f; @@ -1271,19 +1272,20 @@ void Rig::updateHands(bool leftHandEnabled, bool rightHandEnabled, bool hipsEnab int elbowJointIndex = _animSkeleton->nameToJointIndex("LeftForeArm"); if (ENABLE_POLE_VECTORS && !leftArmEnabled && handJointIndex >= 0 && armJointIndex >= 0 && elbowJointIndex >= 0) { glm::vec3 poleVector = calculateElbowPoleVector(handJointIndex, elbowJointIndex, armJointIndex, hipsIndex, true); + glm::vec3 sensorPoleVector = transformVectorFast(rigToSensorMatrix, poleVector); // smooth toward desired pole vector from previous pole vector... to reduce jitter if (!_prevLeftHandPoleVectorValid) { _prevLeftHandPoleVectorValid = true; - _prevLeftHandPoleVector = poleVector; + _prevLeftHandPoleVector = sensorPoleVector; } - glm::quat deltaRot = rotationBetween(_prevLeftHandPoleVector, poleVector); + glm::quat deltaRot = rotationBetween(_prevLeftHandPoleVector, sensorPoleVector); glm::quat smoothDeltaRot = safeMix(deltaRot, Quaternions::IDENTITY, ELBOW_POLE_VECTOR_BLEND_FACTOR); _prevLeftHandPoleVector = smoothDeltaRot * _prevLeftHandPoleVector; _animVars.set("leftHandPoleVectorEnabled", true); _animVars.set("leftHandPoleReferenceVector", Vectors::UNIT_X); - _animVars.set("leftHandPoleVector", _prevLeftHandPoleVector); + _animVars.set("leftHandPoleVector", transformVectorFast(sensorToRigMatrix, _prevLeftHandPoleVector)); } else { _prevLeftHandPoleVectorValid = false; _animVars.set("leftHandPoleVectorEnabled", false); @@ -1318,19 +1320,20 @@ void Rig::updateHands(bool leftHandEnabled, bool rightHandEnabled, bool hipsEnab int elbowJointIndex = _animSkeleton->nameToJointIndex("RightForeArm"); if (ENABLE_POLE_VECTORS && !rightArmEnabled && handJointIndex >= 0 && armJointIndex >= 0 && elbowJointIndex >= 0) { glm::vec3 poleVector = calculateElbowPoleVector(handJointIndex, elbowJointIndex, armJointIndex, hipsIndex, false); + glm::vec3 sensorPoleVector = transformVectorFast(rigToSensorMatrix, poleVector); // smooth toward desired pole vector from previous pole vector... to reduce jitter if (!_prevRightHandPoleVectorValid) { _prevRightHandPoleVectorValid = true; - _prevRightHandPoleVector = poleVector; + _prevRightHandPoleVector = sensorPoleVector; } - glm::quat deltaRot = rotationBetween(_prevRightHandPoleVector, poleVector); + glm::quat deltaRot = rotationBetween(_prevRightHandPoleVector, sensorPoleVector); glm::quat smoothDeltaRot = safeMix(deltaRot, Quaternions::IDENTITY, ELBOW_POLE_VECTOR_BLEND_FACTOR); _prevRightHandPoleVector = smoothDeltaRot * _prevRightHandPoleVector; _animVars.set("rightHandPoleVectorEnabled", true); _animVars.set("rightHandPoleReferenceVector", -Vectors::UNIT_X); - _animVars.set("rightHandPoleVector", _prevRightHandPoleVector); + _animVars.set("rightHandPoleVector", transformVectorFast(sensorToRigMatrix, _prevRightHandPoleVector)); } else { _prevRightHandPoleVectorValid = false; _animVars.set("rightHandPoleVectorEnabled", false); @@ -1345,7 +1348,8 @@ void Rig::updateHands(bool leftHandEnabled, bool rightHandEnabled, bool hipsEnab } } -void Rig::updateFeet(bool leftFootEnabled, bool rightFootEnabled, const AnimPose& leftFootPose, const AnimPose& rightFootPose) { +void Rig::updateFeet(bool leftFootEnabled, bool rightFootEnabled, const AnimPose& leftFootPose, const AnimPose& rightFootPose, + const glm::mat4& rigToSensorMatrix, const glm::mat4& sensorToRigMatrix) { const float KNEE_POLE_VECTOR_BLEND_FACTOR = 0.95f; @@ -1360,19 +1364,20 @@ void Rig::updateFeet(bool leftFootEnabled, bool rightFootEnabled, const AnimPose int kneeJointIndex = _animSkeleton->nameToJointIndex("LeftLeg"); int upLegJointIndex = _animSkeleton->nameToJointIndex("LeftUpLeg"); glm::vec3 poleVector = calculateKneePoleVector(footJointIndex, kneeJointIndex, upLegJointIndex, hipsIndex, leftFootPose); + glm::vec3 sensorPoleVector = transformVectorFast(rigToSensorMatrix, poleVector); - // smooth toward desired pole vector from previous pole vector... to reduce jitter + // smooth toward desired pole vector from previous pole vector... to reduce jitter, but in sensor space. if (!_prevLeftFootPoleVectorValid) { _prevLeftFootPoleVectorValid = true; - _prevLeftFootPoleVector = poleVector; + _prevLeftFootPoleVector = sensorPoleVector; } - glm::quat deltaRot = rotationBetween(_prevLeftFootPoleVector, poleVector); + glm::quat deltaRot = rotationBetween(_prevLeftFootPoleVector, sensorPoleVector); glm::quat smoothDeltaRot = safeMix(deltaRot, Quaternions::IDENTITY, KNEE_POLE_VECTOR_BLEND_FACTOR); _prevLeftFootPoleVector = smoothDeltaRot * _prevLeftFootPoleVector; _animVars.set("leftFootPoleVectorEnabled", true); _animVars.set("leftFootPoleReferenceVector", Vectors::UNIT_Z); - _animVars.set("leftFootPoleVector", _prevLeftFootPoleVector); + _animVars.set("leftFootPoleVector", transformVectorFast(sensorToRigMatrix, _prevLeftFootPoleVector)); } else { _animVars.unset("leftFootPosition"); _animVars.unset("leftFootRotation"); @@ -1390,19 +1395,20 @@ void Rig::updateFeet(bool leftFootEnabled, bool rightFootEnabled, const AnimPose int kneeJointIndex = _animSkeleton->nameToJointIndex("RightLeg"); int upLegJointIndex = _animSkeleton->nameToJointIndex("RightUpLeg"); glm::vec3 poleVector = calculateKneePoleVector(footJointIndex, kneeJointIndex, upLegJointIndex, hipsIndex, rightFootPose); + glm::vec3 sensorPoleVector = transformVectorFast(rigToSensorMatrix, poleVector); // smooth toward desired pole vector from previous pole vector... to reduce jitter if (!_prevRightFootPoleVectorValid) { _prevRightFootPoleVectorValid = true; - _prevRightFootPoleVector = poleVector; + _prevRightFootPoleVector = sensorPoleVector; } - glm::quat deltaRot = rotationBetween(_prevRightFootPoleVector, poleVector); + glm::quat deltaRot = rotationBetween(_prevRightFootPoleVector, sensorPoleVector); glm::quat smoothDeltaRot = safeMix(deltaRot, Quaternions::IDENTITY, KNEE_POLE_VECTOR_BLEND_FACTOR); _prevRightFootPoleVector = smoothDeltaRot * _prevRightFootPoleVector; _animVars.set("rightFootPoleVectorEnabled", true); _animVars.set("rightFootPoleReferenceVector", Vectors::UNIT_Z); - _animVars.set("rightFootPoleVector", _prevRightFootPoleVector); + _animVars.set("rightFootPoleVector", transformVectorFast(sensorToRigMatrix, _prevRightFootPoleVector)); } else { _animVars.unset("rightFootPosition"); _animVars.unset("rightFootRotation"); @@ -1546,16 +1552,18 @@ void Rig::updateFromControllerParameters(const ControllerParameters& params, flo bool spine2Enabled = params.primaryControllerFlags[PrimaryControllerType_Spine2] & (uint8_t)ControllerFlags::Enabled; bool leftArmEnabled = params.secondaryControllerFlags[SecondaryControllerType_LeftArm] & (uint8_t)ControllerFlags::Enabled; bool rightArmEnabled = params.secondaryControllerFlags[SecondaryControllerType_RightArm] & (uint8_t)ControllerFlags::Enabled; + glm::mat4 sensorToRigMatrix = glm::inverse(params.rigToSensorMatrix); updateHead(headEnabled, hipsEnabled, params.primaryControllerPoses[PrimaryControllerType_Head]); updateHands(leftHandEnabled, rightHandEnabled, hipsEnabled, hipsEstimated, leftArmEnabled, rightArmEnabled, dt, params.primaryControllerPoses[PrimaryControllerType_LeftHand], params.primaryControllerPoses[PrimaryControllerType_RightHand], - params.hipsShapeInfo, params.spineShapeInfo, params.spine1ShapeInfo, params.spine2ShapeInfo); + params.hipsShapeInfo, params.spineShapeInfo, params.spine1ShapeInfo, params.spine2ShapeInfo, + params.rigToSensorMatrix, sensorToRigMatrix); updateFeet(leftFootEnabled, rightFootEnabled, - params.primaryControllerPoses[PrimaryControllerType_LeftFoot], params.primaryControllerPoses[PrimaryControllerType_RightFoot]); - + params.primaryControllerPoses[PrimaryControllerType_LeftFoot], params.primaryControllerPoses[PrimaryControllerType_RightFoot], + params.rigToSensorMatrix, sensorToRigMatrix); if (headEnabled) { // Blend IK chains toward the joint limit centers, this should stablize head and hand ik. diff --git a/libraries/animation/src/Rig.h b/libraries/animation/src/Rig.h index e30b5d655c..ffa3a128b9 100644 --- a/libraries/animation/src/Rig.h +++ b/libraries/animation/src/Rig.h @@ -75,6 +75,7 @@ public: }; struct ControllerParameters { + glm::mat4 rigToSensorMatrix; AnimPose primaryControllerPoses[NumPrimaryControllerTypes]; // rig space uint8_t primaryControllerFlags[NumPrimaryControllerTypes]; AnimPose secondaryControllerPoses[NumSecondaryControllerTypes]; // rig space @@ -231,8 +232,10 @@ protected: bool leftArmEnabled, bool rightArmEnabled, float dt, const AnimPose& leftHandPose, const AnimPose& rightHandPose, const FBXJointShapeInfo& hipsShapeInfo, const FBXJointShapeInfo& spineShapeInfo, - const FBXJointShapeInfo& spine1ShapeInfo, const FBXJointShapeInfo& spine2ShapeInfo); - void updateFeet(bool leftFootEnabled, bool rightFootEnabled, const AnimPose& leftFootPose, const AnimPose& rightFootPose); + const FBXJointShapeInfo& spine1ShapeInfo, const FBXJointShapeInfo& spine2ShapeInfo, + const glm::mat4& rigToSensorMatrix, const glm::mat4& sensorToRigMatrix); + void updateFeet(bool leftFootEnabled, bool rightFootEnabled, const AnimPose& leftFootPose, const AnimPose& rightFootPose, + const glm::mat4& rigToSensorMatrix, const glm::mat4& sensorToRigMatrix); void updateEyeJoint(int index, const glm::vec3& modelTranslation, const glm::quat& modelRotation, const glm::vec3& lookAt, const glm::vec3& saccade); void calcAnimAlpha(float speed, const std::vector& referenceSpeeds, float* alphaOut) const; @@ -359,16 +362,16 @@ protected: int _nextStateHandlerId { 0 }; QMutex _stateMutex; - glm::vec3 _prevRightFootPoleVector { Vectors::UNIT_Z }; + glm::vec3 _prevRightFootPoleVector { Vectors::UNIT_Z }; // sensor space bool _prevRightFootPoleVectorValid { false }; - glm::vec3 _prevLeftFootPoleVector { Vectors::UNIT_Z }; + glm::vec3 _prevLeftFootPoleVector { Vectors::UNIT_Z }; // sensor space bool _prevLeftFootPoleVectorValid { false }; - glm::vec3 _prevRightHandPoleVector { -Vectors::UNIT_Z }; + glm::vec3 _prevRightHandPoleVector { -Vectors::UNIT_Z }; // sensor space bool _prevRightHandPoleVectorValid { false }; - glm::vec3 _prevLeftHandPoleVector { -Vectors::UNIT_Z }; + glm::vec3 _prevLeftHandPoleVector { -Vectors::UNIT_Z }; // sensor space bool _prevLeftHandPoleVectorValid { false }; int _rigId; diff --git a/libraries/entities/src/SimpleEntitySimulation.cpp b/libraries/entities/src/SimpleEntitySimulation.cpp index 3ed84035ac..28dc7b26c4 100644 --- a/libraries/entities/src/SimpleEntitySimulation.cpp +++ b/libraries/entities/src/SimpleEntitySimulation.cpp @@ -100,7 +100,7 @@ void SimpleEntitySimulation::changeEntityInternal(EntityItemPointer entity) { } } else if (entity->isMovingRelativeToParent()) { SetOfEntities::iterator itr = _simpleKinematicEntities.find(entity); - if (itr != _simpleKinematicEntities.end()) { + if (itr == _simpleKinematicEntities.end()) { _simpleKinematicEntities.insert(entity); entity->setLastSimulated(usecTimestampNow()); } @@ -118,7 +118,7 @@ void SimpleEntitySimulation::changeEntityInternal(EntityItemPointer entity) { if (entity->isMovingRelativeToParent()) { SetOfEntities::iterator itr = _simpleKinematicEntities.find(entity); - if (itr != _simpleKinematicEntities.end()) { + if (itr == _simpleKinematicEntities.end()) { _simpleKinematicEntities.insert(entity); entity->setLastSimulated(usecTimestampNow()); } diff --git a/libraries/physics/src/EntityMotionState.cpp b/libraries/physics/src/EntityMotionState.cpp index e7b9f17739..9089f02aaf 100644 --- a/libraries/physics/src/EntityMotionState.cpp +++ b/libraries/physics/src/EntityMotionState.cpp @@ -834,3 +834,14 @@ void EntityMotionState::clearObjectVelocities() const { } _entity->setAcceleration(glm::vec3(0.0f)); } + +void EntityMotionState::saveKinematicState(btScalar timeStep) { + _body->saveKinematicState(timeStep); + + // This is a WORKAROUND for a quirk in Bullet: due to floating point error slow spinning kinematic objects will + // have a measured angular velocity of zero. This probably isn't a bug that the Bullet team is interested in + // fixing since there is one very simple workaround: use double-precision math for the physics simulation. + // We're not ready migrate to double-precision yet so we explicitly work around it by slamming the RigidBody's + // angular velocity with the value in the entity. + _body->setAngularVelocity(glmToBullet(_entity->getWorldAngularVelocity())); +} diff --git a/libraries/physics/src/EntityMotionState.h b/libraries/physics/src/EntityMotionState.h index c2d4f8d87e..b215537d55 100644 --- a/libraries/physics/src/EntityMotionState.h +++ b/libraries/physics/src/EntityMotionState.h @@ -97,6 +97,7 @@ public: OwnershipState getOwnershipState() const { return _ownershipState; } void setRegion(uint8_t region); + void saveKinematicState(btScalar timeStep) override; protected: void updateSendVelocities(); diff --git a/libraries/physics/src/ObjectMotionState.cpp b/libraries/physics/src/ObjectMotionState.cpp index 161d6bd636..0e6eb2511d 100644 --- a/libraries/physics/src/ObjectMotionState.cpp +++ b/libraries/physics/src/ObjectMotionState.cpp @@ -347,7 +347,7 @@ void ObjectMotionState::updateLastKinematicStep() { } void ObjectMotionState::updateBodyMassProperties() { - float mass = getMass(); + btScalar mass = getMass(); btVector3 inertia(1.0f, 1.0f, 1.0f); if (mass > 0.0f) { _body->getCollisionShape()->calculateLocalInertia(mass, inertia); @@ -356,3 +356,7 @@ void ObjectMotionState::updateBodyMassProperties() { _body->updateInertiaTensor(); } +void ObjectMotionState::saveKinematicState(btScalar timeStep) { + _body->saveKinematicState(timeStep); +} + diff --git a/libraries/physics/src/ObjectMotionState.h b/libraries/physics/src/ObjectMotionState.h index 4a3b200559..7439c1c38d 100644 --- a/libraries/physics/src/ObjectMotionState.h +++ b/libraries/physics/src/ObjectMotionState.h @@ -165,6 +165,7 @@ public: virtual bool isLocallyOwned() const { return false; } virtual bool isLocallyOwnedOrShouldBe() const { return false; } // aka shouldEmitCollisionEvents() + virtual void saveKinematicState(btScalar timeStep); friend class PhysicsEngine; diff --git a/libraries/physics/src/ThreadSafeDynamicsWorld.cpp b/libraries/physics/src/ThreadSafeDynamicsWorld.cpp index 07d5ceb9ac..17a52f7cd9 100644 --- a/libraries/physics/src/ThreadSafeDynamicsWorld.cpp +++ b/libraries/physics/src/ThreadSafeDynamicsWorld.cpp @@ -162,7 +162,13 @@ void ThreadSafeDynamicsWorld::saveKinematicState(btScalar timeStep) { for (int i=0;iisKinematicObject() && body->getActivationState() != ISLAND_SLEEPING) { - body->saveKinematicState(timeStep); + if (body->getMotionState()) { + btMotionState* motionState = body->getMotionState(); + ObjectMotionState* objectMotionState = static_cast(motionState); + objectMotionState->saveKinematicState(timeStep); + } else { + body->saveKinematicState(timeStep); + } } } } diff --git a/libraries/render-utils/src/RenderCommonTask.cpp b/libraries/render-utils/src/RenderCommonTask.cpp index 63d07af1c2..24715f0afb 100644 --- a/libraries/render-utils/src/RenderCommonTask.cpp +++ b/libraries/render-utils/src/RenderCommonTask.cpp @@ -60,7 +60,7 @@ void DrawOverlay3D::run(const RenderContextPointer& renderContext, const Inputs& if (_opaquePass) { gpu::doInBatch("DrawOverlay3D::run::clear", args->_context, [&](gpu::Batch& batch){ batch.enableStereo(false); - batch.clearFramebuffer(gpu::Framebuffer::BUFFER_DEPTHSTENCIL, glm::vec4(), 1.f, 0, false); + batch.clearFramebuffer(gpu::Framebuffer::BUFFER_DEPTH, glm::vec4(), 1.f, 0, false); }); } diff --git a/scripts/system/controllers/handTouch.js b/scripts/system/controllers/handTouch.js index c20b86b775..5e633d4740 100644 --- a/scripts/system/controllers/handTouch.js +++ b/scripts/system/controllers/handTouch.js @@ -605,7 +605,6 @@ var finger = fingerKeys[i]; var LOOKUP_DISTANCE_MULTIPLIER = 1.5; var dist = LOOKUP_DISTANCE_MULTIPLIER*data.distance; - console.log("distance: " + dist); var checkOffset = { x: data.perpendicular.x * dist, y: data.perpendicular.y * dist, diff --git a/scripts/system/edit.js b/scripts/system/edit.js index 08e7a541d5..85a2d9a699 100644 --- a/scripts/system/edit.js +++ b/scripts/system/edit.js @@ -1784,7 +1784,7 @@ var keyReleaseEvent = function (event) { deleteSelectedEntities(); } else if (event.text === "ESC") { selectionManager.clearSelections(); - } else if (event.text === "TAB") { + } else if (event.text === "t") { selectionDisplay.toggleSpaceMode(); } else if (event.text === "f") { if (isActive) { diff --git a/scripts/system/html/js/SnapshotReview.js b/scripts/system/html/js/SnapshotReview.js index 0c3e6199f3..91866605a4 100644 --- a/scripts/system/html/js/SnapshotReview.js +++ b/scripts/system/html/js/SnapshotReview.js @@ -668,6 +668,7 @@ window.onload = function () { addImage(element, messageOptions.isLoggedIn, idx === 0 && messageOptions.canShare, idx === 1, false, false, false, true); }); document.getElementById("p1").classList.add("processingGif"); + document.getElementById("snap-button").disabled = true; } else { var gifPath = message.image_data[0].localPath, p1img = document.getElementById('p1img'); @@ -677,14 +678,15 @@ window.onload = function () { shareForUrl("p1"); appendShareBar("p1", messageOptions.isLoggedIn, messageOptions.canShare, true, false, false, messageOptions.canBlast); document.getElementById("p1").classList.remove("processingGif"); + document.getElementById("snap-button").disabled = false; } } else { imageCount = message.image_data.length; message.image_data.forEach(function (element) { addImage(element, messageOptions.isLoggedIn, messageOptions.canShare, false, false, false, false, true); }); + document.getElementById("snap-button").disabled = false; } - document.getElementById("snap-button").disabled = false; break; case 'captureSettings': handleCaptureSetting(message.setting); @@ -701,7 +703,7 @@ window.onload = function () { case 'snapshotUploadComplete': var isGif = fileExtensionMatches(message.image_url, "gif"); updateShareInfo(isGif ? "p1" : "p0", message.story_id); - if (isPrintProcessing()) { + if (isPrintProcessing()) { setPrintButtonEnabled(); } break; @@ -724,11 +726,11 @@ function snapshotSettings() { })); } function takeSnapshot() { + document.getElementById("snap-button").disabled = true; EventBridge.emitWebEvent(JSON.stringify({ type: "snapshot", action: "takeSnapshot" })); - document.getElementById("snap-button").disabled = true; } function isPrintDisabled() { @@ -739,14 +741,14 @@ function isPrintDisabled() { document.getElementById('print-button').disabled; } function isPrintProcessing() { - var printElement = document.getElementById('print-icon'); + var printElement = document.getElementById('print-icon'); return printElement.classList.contains("print-icon") && printElement.classList.contains("print-icon-loading") && document.getElementById('print-button').disabled; } function isPrintEnabled() { - var printElement = document.getElementById('print-icon'); + var printElement = document.getElementById('print-icon'); return printElement.classList.contains("print-icon") && printElement.classList.contains("print-icon-default") && @@ -773,8 +775,8 @@ function requestPrintButtonUpdate() { })); } -function printToPolaroid() { - if (isPrintEnabled()) { +function printToPolaroid() { + if (isPrintEnabled()) { EventBridge.emitWebEvent(JSON.stringify({ type: "snapshot", action: "printToPolaroid" diff --git a/scripts/system/libraries/entitySelectionTool.js b/scripts/system/libraries/entitySelectionTool.js index cd3c9fe418..d30de1045f 100644 --- a/scripts/system/libraries/entitySelectionTool.js +++ b/scripts/system/libraries/entitySelectionTool.js @@ -215,8 +215,10 @@ SelectionManager = (function() { that.worldRotation = properties.boundingBox.rotation; that.entityType = properties.type; - - SelectionDisplay.setSpaceMode(SPACE_LOCAL); + + if (selectionUpdated) { + SelectionDisplay.setSpaceMode(SPACE_LOCAL); + } } else { that.localRotation = null; that.localDimensions = null; @@ -1435,7 +1437,7 @@ SelectionDisplay = (function() { that.setHandleRotateYawVisible(!activeTool || isActiveTool(handleRotateYawRing)); that.setHandleRotateRollVisible(!activeTool || isActiveTool(handleRotateRollRing)); - var showScaleStretch = !activeTool && SelectionManager.selections.length === 1; + var showScaleStretch = !activeTool && SelectionManager.selections.length === 1 && spaceMode === SPACE_LOCAL; that.setHandleStretchXVisible(showScaleStretch || isActiveTool(handleStretchXSphere)); that.setHandleStretchYVisible(showScaleStretch || isActiveTool(handleStretchYSphere)); that.setHandleStretchZVisible(showScaleStretch || isActiveTool(handleStretchZSphere)); @@ -2061,7 +2063,7 @@ SelectionDisplay = (function() { }; var onMove = function(event) { - var proportional = (spaceMode === SPACE_WORLD) || directionEnum === STRETCH_DIRECTION.ALL; + var proportional = directionEnum === STRETCH_DIRECTION.ALL; var position, rotation; if (spaceMode === SPACE_LOCAL) {