Added more arrow controls to move camera when in mirror mode, new guitar chords.

This commit is contained in:
Philip Rosedale 2014-05-07 16:51:22 -07:00
parent 449e3f1410
commit e6a8c79f9f
3 changed files with 39 additions and 12 deletions

View file

@ -27,9 +27,18 @@ function vMinus(a, b) {
// First, load two percussion sounds to be used on the sticks
var chord1 = new Sound("https://s3-us-west-1.amazonaws.com/highfidelity-public/sounds/Guitars/Guitar+-+Nylon+A.raw");
var chord2 = new Sound("https://s3-us-west-1.amazonaws.com/highfidelity-public/sounds/Guitars/Guitar+-+Nylon+B.raw");
var chord3 = new Sound("https://s3-us-west-1.amazonaws.com/highfidelity-public/sounds/Guitars/Guitar+-+Nylon+E.raw");
var guitarType = 2;
if (guitarType == 1) {
var chord1 = new Sound("https://s3-us-west-1.amazonaws.com/highfidelity-public/sounds/Guitars/Guitar+-+Nylon+A.raw");
var chord2 = new Sound("https://s3-us-west-1.amazonaws.com/highfidelity-public/sounds/Guitars/Guitar+-+Nylon+B.raw");
var chord3 = new Sound("https://s3-us-west-1.amazonaws.com/highfidelity-public/sounds/Guitars/Guitar+-+Nylon+E.raw");
} else {
var chord1 = new Sound("https://s3-us-west-1.amazonaws.com/highfidelity-public/sounds/Guitars/Guitar+-+Metal+A+short.raw");
var chord2 = new Sound("https://s3-us-west-1.amazonaws.com/highfidelity-public/sounds/Guitars/Guitar+-+Metal+B+short.raw");
var chord3 = new Sound("https://s3-us-west-1.amazonaws.com/highfidelity-public/sounds/Guitars/Guitar+-+Metal+E+short.raw");
}
var whichChord = chord1;
@ -56,7 +65,7 @@ function checkHands(deltaTime) {
if (palm == strumHand) {
var STRUM_HEIGHT_ABOVE_PELVIS = 0.15;
var STRUM_HEIGHT_ABOVE_PELVIS = -0.30;
var strumTriggerHeight = myPelvis.y + STRUM_HEIGHT_ABOVE_PELVIS;
//printVector(position);
if ((position.y < strumTriggerHeight) && (lastPosition.y >= strumTriggerHeight)) {
@ -72,9 +81,9 @@ function checkHands(deltaTime) {
// This is the chord controller
var distanceFromPelvis = Vec3.length(Vec3.subtract(position, myPelvis));
//print(distanceFromPelvis);
if (distanceFromPelvis > 0.50) {
if (distanceFromPelvis > 0.63) {
whichChord = chord3;
} else if (distanceFromPelvis > 0.35) {
} else if (distanceFromPelvis > 0.55) {
whichChord = chord2;
} else {
whichChord = chord1;

View file

@ -572,8 +572,8 @@ void Application::paintGL() {
glm::vec3 eyePosition = _myAvatar->getHead()->calculateAverageEyePosition();
float headHeight = eyePosition.y - _myAvatar->getPosition().y;
_myCamera.setDistance(MIRROR_FULLSCREEN_DISTANCE * _myAvatar->getScale() * _scaleMirror);
_myCamera.setTargetPosition(_myAvatar->getPosition() + glm::vec3(0, headHeight, 0));
_myCamera.setTargetRotation(_myAvatar->getWorldAlignedOrientation() * glm::quat(glm::vec3(0.0f, PI, 0.0f)));
_myCamera.setTargetPosition(_myAvatar->getPosition() + glm::vec3(0, headHeight + (_raiseMirror * _myAvatar->getScale()), 0));
_myCamera.setTargetRotation(_myAvatar->getWorldAlignedOrientation() * glm::quat(glm::vec3(0.0f, PI + _rotateMirror, 0.0f)));
// if the head would intersect the near clip plane, we must push the camera out
glm::vec3 relativePosition = glm::inverse(_myCamera.getTargetRotation()) *
@ -870,7 +870,11 @@ void Application::keyPressEvent(QKeyEvent* event) {
case Qt::Key_Up:
if (_myCamera.getMode() == CAMERA_MODE_MIRROR) {
_scaleMirror *= 0.95;
if (!isShifted) {
_scaleMirror *= 0.95f;
} else {
_raiseMirror += 0.05f;
}
} else {
_myAvatar->setDriveKeys(isShifted ? UP : FWD, 1.f);
}
@ -878,18 +882,30 @@ void Application::keyPressEvent(QKeyEvent* event) {
case Qt::Key_Down:
if (_myCamera.getMode() == CAMERA_MODE_MIRROR) {
_scaleMirror *= 1.05;
if (!isShifted) {
_scaleMirror *= 1.05f;
} else {
_raiseMirror -= 0.05f;
}
} else {
_myAvatar->setDriveKeys(isShifted ? DOWN : BACK, 1.f);
}
break;
case Qt::Key_Left:
_myAvatar->setDriveKeys(isShifted ? LEFT : ROT_LEFT, 1.f);
if (_myCamera.getMode() == CAMERA_MODE_MIRROR) {
_rotateMirror += PI / 20.f;
} else {
_myAvatar->setDriveKeys(isShifted ? LEFT : ROT_LEFT, 1.f);
}
break;
case Qt::Key_Right:
_myAvatar->setDriveKeys(isShifted ? RIGHT : ROT_RIGHT, 1.f);
if (_myCamera.getMode() == CAMERA_MODE_MIRROR) {
_rotateMirror -= PI / 20.f;
} else {
_myAvatar->setDriveKeys(isShifted ? RIGHT : ROT_RIGHT, 1.f);
}
break;
case Qt::Key_I:

View file

@ -457,6 +457,8 @@ private:
glm::mat4 _projectionMatrix;
float _scaleMirror;
float _rotateMirror;
float _raiseMirror;
glm::mat4 _shadowMatrix;