mirror of
https://github.com/lubosz/overte.git
synced 2025-08-07 17:41:12 +02:00
Merge branch 'master' of https://github.com/highfidelity/hifi
This commit is contained in:
commit
70afda6f86
4 changed files with 47 additions and 25 deletions
|
@ -157,9 +157,7 @@ function controller(wichSide) {
|
||||||
|
|
||||||
this.release = function () {
|
this.release = function () {
|
||||||
if (this.grabbing) {
|
if (this.grabbing) {
|
||||||
if (jointList.length <= 0) {
|
jointList = MyAvatar.getJointNames();
|
||||||
jointList = MyAvatar.getJointNames();
|
|
||||||
}
|
|
||||||
|
|
||||||
var closestJointIndex = -1;
|
var closestJointIndex = -1;
|
||||||
var closestJointDistance = 10;
|
var closestJointDistance = 10;
|
||||||
|
|
|
@ -40,6 +40,8 @@ var passedTime = 0.0;
|
||||||
var startPosition = null;
|
var startPosition = null;
|
||||||
var animationLenght = 2.0;
|
var animationLenght = 2.0;
|
||||||
|
|
||||||
|
var sitting = false;
|
||||||
|
|
||||||
// This is the pose we would like to end up
|
// This is the pose we would like to end up
|
||||||
var pose = [
|
var pose = [
|
||||||
{joint:"RightUpLeg", rotation: {x:100.0, y:15.0, z:0.0}},
|
{joint:"RightUpLeg", rotation: {x:100.0, y:15.0, z:0.0}},
|
||||||
|
@ -101,31 +103,41 @@ var standingUpAnimation = function(deltaTime){
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function sitDown() {
|
||||||
|
sitting = true;
|
||||||
|
passedTime = 0.0;
|
||||||
|
startPosition = MyAvatar.position;
|
||||||
|
storeStartPoseAndTransition();
|
||||||
|
try{
|
||||||
|
Script.update.disconnect(standingUpAnimation);
|
||||||
|
} catch(e){
|
||||||
|
// no need to handle. if it wasn't connected no harm done
|
||||||
|
}
|
||||||
|
Script.update.connect(sittingDownAnimation);
|
||||||
|
Overlays.editOverlay(sitDownButton, { visible: false });
|
||||||
|
Overlays.editOverlay(standUpButton, { visible: true });
|
||||||
|
}
|
||||||
|
|
||||||
|
function standUp() {
|
||||||
|
sitting = false;
|
||||||
|
passedTime = 0.0;
|
||||||
|
startPosition = MyAvatar.position;
|
||||||
|
try{
|
||||||
|
Script.update.disconnect(sittingDownAnimation);
|
||||||
|
} catch (e){}
|
||||||
|
Script.update.connect(standingUpAnimation);
|
||||||
|
Overlays.editOverlay(standUpButton, { visible: false });
|
||||||
|
Overlays.editOverlay(sitDownButton, { visible: true });
|
||||||
|
}
|
||||||
|
|
||||||
Controller.mousePressEvent.connect(function(event){
|
Controller.mousePressEvent.connect(function(event){
|
||||||
|
|
||||||
var clickedOverlay = Overlays.getOverlayAtPoint({x: event.x, y: event.y});
|
var clickedOverlay = Overlays.getOverlayAtPoint({x: event.x, y: event.y});
|
||||||
|
|
||||||
if (clickedOverlay == sitDownButton) {
|
if (clickedOverlay == sitDownButton) {
|
||||||
passedTime = 0.0;
|
sitDown();
|
||||||
startPosition = MyAvatar.position;
|
|
||||||
storeStartPoseAndTransition();
|
|
||||||
try{
|
|
||||||
Script.update.disconnect(standingUpAnimation);
|
|
||||||
} catch(e){
|
|
||||||
// no need to handle. if it wasn't connected no harm done
|
|
||||||
}
|
|
||||||
Script.update.connect(sittingDownAnimation);
|
|
||||||
Overlays.editOverlay(sitDownButton, { visible: false });
|
|
||||||
Overlays.editOverlay(standUpButton, { visible: true });
|
|
||||||
} else if (clickedOverlay == standUpButton) {
|
} else if (clickedOverlay == standUpButton) {
|
||||||
passedTime = 0.0;
|
standUp();
|
||||||
startPosition = MyAvatar.position;
|
|
||||||
try{
|
|
||||||
Script.update.disconnect(sittingDownAnimation);
|
|
||||||
} catch (e){}
|
|
||||||
Script.update.connect(standingUpAnimation);
|
|
||||||
Overlays.editOverlay(standUpButton, { visible: false });
|
|
||||||
Overlays.editOverlay(sitDownButton, { visible: true });
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -140,7 +152,19 @@ function update(deltaTime){
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function keyPressEvent(event) {
|
||||||
|
if (event.text === ".") {
|
||||||
|
if (sitting) {
|
||||||
|
standUp();
|
||||||
|
} else {
|
||||||
|
sitDown();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
Script.update.connect(update);
|
Script.update.connect(update);
|
||||||
|
Controller.keyPressEvent.connect(keyPressEvent);
|
||||||
|
|
||||||
Script.scriptEnding.connect(function() {
|
Script.scriptEnding.connect(function() {
|
||||||
|
|
||||||
|
|
|
@ -82,7 +82,7 @@ void OAuthWebViewHandler::displayWebviewForAuthorizationURL(const QUrl& authoriz
|
||||||
_activeWebView = new QWebView;
|
_activeWebView = new QWebView;
|
||||||
|
|
||||||
// keep the window on top and delete it when it closes
|
// keep the window on top and delete it when it closes
|
||||||
_activeWebView->setWindowFlags(Qt::Sheet | Qt::WindowStaysOnTopHint);
|
_activeWebView->setWindowFlags(Qt::Sheet);
|
||||||
_activeWebView->setAttribute(Qt::WA_DeleteOnClose);
|
_activeWebView->setAttribute(Qt::WA_DeleteOnClose);
|
||||||
|
|
||||||
qDebug() << "Displaying QWebView for OAuth authorization at" << authorizationURL.toString();
|
qDebug() << "Displaying QWebView for OAuth authorization at" << authorizationURL.toString();
|
||||||
|
|
|
@ -192,7 +192,7 @@ bool ModelTreeElement::findDetailedRayIntersection(const glm::vec3& origin, cons
|
||||||
|
|
||||||
// if it's in our AABOX for our rotated extents, then check to see if it's in our non-AABox
|
// if it's in our AABOX for our rotated extents, then check to see if it's in our non-AABox
|
||||||
if (rotatedExtentsBox.findRayIntersection(origin, direction, localDistance, localFace)) {
|
if (rotatedExtentsBox.findRayIntersection(origin, direction, localDistance, localFace)) {
|
||||||
|
|
||||||
// extents is the model relative, scaled, centered extents of the model
|
// extents is the model relative, scaled, centered extents of the model
|
||||||
glm::mat4 rotation = glm::mat4_cast(model.getModelRotation());
|
glm::mat4 rotation = glm::mat4_cast(model.getModelRotation());
|
||||||
glm::mat4 translation = glm::translate(model.getPosition());
|
glm::mat4 translation = glm::translate(model.getPosition());
|
||||||
|
@ -202,7 +202,7 @@ bool ModelTreeElement::findDetailedRayIntersection(const glm::vec3& origin, cons
|
||||||
AABox modelFrameBox(extents.minimum, (extents.maximum - extents.minimum));
|
AABox modelFrameBox(extents.minimum, (extents.maximum - extents.minimum));
|
||||||
|
|
||||||
glm::vec3 modelFrameOrigin = glm::vec3(worldToModelMatrix * glm::vec4(origin, 1.0f));
|
glm::vec3 modelFrameOrigin = glm::vec3(worldToModelMatrix * glm::vec4(origin, 1.0f));
|
||||||
glm::vec3 modelFrameDirection = glm::vec3(worldToModelMatrix * glm::vec4(direction, 1.0f));
|
glm::vec3 modelFrameDirection = glm::vec3(worldToModelMatrix * glm::vec4(direction, 0.0f));
|
||||||
|
|
||||||
// we can use the AABox's ray intersection by mapping our origin and direction into the model frame
|
// we can use the AABox's ray intersection by mapping our origin and direction into the model frame
|
||||||
// and testing intersection there.
|
// and testing intersection there.
|
||||||
|
|
Loading…
Reference in a new issue