This commit is contained in:
Philip Rosedale 2014-03-25 14:23:27 -07:00
commit 61bfc77c06
2 changed files with 23 additions and 21 deletions

View file

@ -4,3 +4,4 @@ Script.include("lookWithTouch.js");
Script.include("editVoxels.js");
Script.include("selectAudioDevice.js");
Script.include("hydraMove.js");
Script.include("inspect.js");

View file

@ -9,6 +9,7 @@
//
//
var startedTouching = false;
var lastX = 0;
var lastY = 0;
var yawFromMouse = 0;
@ -21,12 +22,14 @@ function touchBeginEvent(event) {
}
lastX = event.x;
lastY = event.y;
startedTouching = true;
}
function touchEndEvent(event) {
if (wantDebugging) {
print("touchEndEvent event.x,y=" + event.x + ", " + event.y);
}
startedTouching = false;
}
function touchUpdateEvent(event) {
@ -44,6 +47,7 @@ function touchUpdateEvent(event) {
}
function update(deltaTime) {
if (startedTouching) {
// rotate body yaw for yaw received from mouse
var newOrientation = Quat.multiply(MyAvatar.orientation, Quat.fromPitchYawRollRadians(0, yawFromMouse, 0));
if (wantDebugging) {
@ -63,6 +67,7 @@ function update(deltaTime) {
MyAvatar.headPitch = newPitch;
pitchFromMouse = 0;
}
}
// Map the mouse events to our functions
Controller.touchBeginEvent.connect(touchBeginEvent);
@ -77,10 +82,6 @@ function scriptEnding() {
Controller.releaseTouchEvents();
}
MyAvatar.bodyYaw = 0;
MyAvatar.bodyPitch = 0;
MyAvatar.bodyRoll = 0;
// would be nice to change to update
Script.update.connect(update);
Script.scriptEnding.connect(scriptEnding);