mirror of
https://github.com/overte-org/overte.git
synced 2025-04-21 08:04:01 +02:00
Merge branch 'vive' of github.com:Atlante45/hifi into baseball
This commit is contained in:
commit
2bdd282708
3 changed files with 27 additions and 22 deletions
|
@ -62,7 +62,7 @@ void AvatarActionHold::updateActionWorker(float deltaTimeStep) {
|
|||
|
||||
if (it != std::end(plugins)) {
|
||||
const auto& vive = it->dynamicCast<ViveControllerManager>();
|
||||
auto index = (_hand == "right") ? 0 : 1;
|
||||
auto index = (_hand == "left") ? 0 : 1;
|
||||
auto userInputMapper = DependencyManager::get<UserInputMapper>();
|
||||
auto translation = extractTranslation(userInputMapper->getSensorToWorldMat());
|
||||
auto rotation = glm::quat_cast(userInputMapper->getSensorToWorldMat());
|
||||
|
@ -71,16 +71,16 @@ void AvatarActionHold::updateActionWorker(float deltaTimeStep) {
|
|||
const glm::quat quarterX = glm::angleAxis(PI / 2.0f, glm::vec3(1.0f, 0.0f, 0.0f));
|
||||
const glm::quat yFlip = glm::angleAxis(PI, glm::vec3(0.0f, 1.0f, 0.0f));
|
||||
palmPosition = translation + rotation * vive->getPosition(index);
|
||||
palmRotation = rotation * vive->getRotation(index) * yFlip * quarterX;
|
||||
palmRotation = rotation * vive->getRotation(index) * yFlip * quarterX * glm::angleAxis(PI, glm::vec3(1.0f, 0.0f, 0.0f)) * glm::angleAxis(PI_OVER_TWO, glm::vec3(0.0f, 0.0f, 1.0f));
|
||||
} else
|
||||
#endif
|
||||
if (_hand == "right") {
|
||||
palmPosition = holdingAvatar->getRightPalmPosition();
|
||||
palmRotation = holdingAvatar->getRightPalmRotation();
|
||||
} else {
|
||||
palmPosition = holdingAvatar->getLeftPalmPosition();
|
||||
palmRotation = holdingAvatar->getLeftPalmRotation();
|
||||
}
|
||||
if (_hand == "right") {
|
||||
palmPosition = holdingAvatar->getRightPalmPosition();
|
||||
palmRotation = holdingAvatar->getRightPalmRotation();
|
||||
} else {
|
||||
palmPosition = holdingAvatar->getLeftPalmPosition();
|
||||
palmRotation = holdingAvatar->getLeftPalmRotation();
|
||||
}
|
||||
|
||||
rotation = palmRotation * _relativeRotation;
|
||||
offset = rotation * _relativePosition;
|
||||
|
|
|
@ -285,11 +285,17 @@ void ViveControllerManager::update(float deltaTime, bool jointsCaptured) {
|
|||
handleButtonEvent(i, pressed, left);
|
||||
}
|
||||
for (uint32_t i = 0; i < vr::k_unControllerStateAxisCount; i++) {
|
||||
handleAxisEvent(i, controllerState.rAxis[i].x, controllerState.rAxis[i].y, left);
|
||||
auto mask = vr::ButtonMaskFromId((vr::EVRButtonId)(i + vr::k_EButton_Axis0));
|
||||
bool pressed = 0 != (controllerState.ulButtonPressed & mask);
|
||||
if (pressed || true) {
|
||||
handleAxisEvent(i, controllerState.rAxis[i].x, controllerState.rAxis[i].y, left);
|
||||
} else {
|
||||
handleAxisEvent(i, 0.0f, 0.0f, left);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
auto userInputMapper = DependencyManager::get<controller::UserInputMapper>();
|
||||
|
||||
if (numTrackedControllers == 0) {
|
||||
|
@ -422,7 +428,6 @@ void ViveControllerManager::handlePoseEvent(const mat4& mat, bool left) {
|
|||
|
||||
position += rotation * translationOffset;
|
||||
rotation = rotation * rotationOffset;
|
||||
//{quat, x = 0.653281, y = -0.270598, z = 0.653281, w = 0.270598}{vec3, x = 0.0381, y = -0.0381, z = -0.1524}
|
||||
|
||||
_poseStateMap[left ? controller::LEFT_HAND : controller::RIGHT_HAND] = controller::Pose(position, rotation);
|
||||
}
|
||||
|
|
|
@ -120,16 +120,16 @@ static bool hadUncaughtExceptions(QScriptEngine& engine, const QString& fileName
|
|||
}
|
||||
|
||||
ScriptEngine::ScriptEngine(const QString& scriptContents, const QString& fileNameString, bool wantSignals) :
|
||||
_scriptContents(scriptContents),
|
||||
_isFinished(false),
|
||||
_isRunning(false),
|
||||
_isInitialized(false),
|
||||
_timerFunctionMap(),
|
||||
_wantSignals(wantSignals),
|
||||
_fileNameString(fileNameString),
|
||||
_isUserLoaded(false),
|
||||
_isReloading(false),
|
||||
_arrayBufferClass(new ArrayBufferClass(this))
|
||||
_scriptContents(scriptContents),
|
||||
_isFinished(false),
|
||||
_isRunning(false),
|
||||
_isInitialized(false),
|
||||
_timerFunctionMap(),
|
||||
_wantSignals(wantSignals),
|
||||
_fileNameString(fileNameString),
|
||||
_isUserLoaded(false),
|
||||
_isReloading(false),
|
||||
_arrayBufferClass(new ArrayBufferClass(this))
|
||||
{
|
||||
_allScriptsMutex.lock();
|
||||
_allKnownScriptEngines.insert(this);
|
||||
|
|
Loading…
Reference in a new issue