mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 16:18:05 +02:00
added dead zone to pitch in hydra move, animated models show up where you are
This commit is contained in:
parent
ad4556ab56
commit
85b94ff71c
2 changed files with 21 additions and 13 deletions
|
@ -21,9 +21,9 @@ var roll = 0.0;
|
||||||
var rotation = Quat.fromPitchYawRollDegrees(pitch, yaw, roll)
|
var rotation = Quat.fromPitchYawRollDegrees(pitch, yaw, roll)
|
||||||
|
|
||||||
var originalProperties = {
|
var originalProperties = {
|
||||||
position: { x: 10,
|
position: { x: MyAvatar.position.x,
|
||||||
y: 0,
|
y: MyAvatar.position.y,
|
||||||
z: 0 },
|
z: MyAvatar.position.z },
|
||||||
|
|
||||||
radius : 1,
|
radius : 1,
|
||||||
|
|
||||||
|
@ -58,9 +58,9 @@ function moveModel(deltaTime) {
|
||||||
if (animationFPS == 30) {
|
if (animationFPS == 30) {
|
||||||
animationFPS = 10;
|
animationFPS = 10;
|
||||||
} else if (animationFPS == 10) {
|
} else if (animationFPS == 10) {
|
||||||
animationFPS = 60;
|
animationFPS = 10;
|
||||||
} else if (animationFPS == 60) {
|
} else if (animationFPS == 60) {
|
||||||
animationFPS = 30;
|
animationFPS = 10;
|
||||||
}
|
}
|
||||||
print("animationFPS=" + animationFPS);
|
print("animationFPS=" + animationFPS);
|
||||||
isPlaying = true;
|
isPlaying = true;
|
||||||
|
|
|
@ -145,20 +145,28 @@ function handleGrabBehavior(deltaTime) {
|
||||||
|
|
||||||
// add some rotation...
|
// add some rotation...
|
||||||
var deltaRotation = getGrabRotation();
|
var deltaRotation = getGrabRotation();
|
||||||
var GRAB_CONTROLLER_PITCH_SCALING = 2.5;
|
var PITCH_SCALING = 2.0;
|
||||||
var GRAB_CONTROLLER_YAW_SCALING = 2.5;
|
var PITCH_DEAD_ZONE = 2.0;
|
||||||
var GRAB_CONTROLLER_ROLL_SCALING = 2.5;
|
var YAW_SCALING = 2.0;
|
||||||
|
var ROLL_SCALING = 2.0;
|
||||||
|
|
||||||
var euler = Quat.safeEulerAngles(deltaRotation);
|
var euler = Quat.safeEulerAngles(deltaRotation);
|
||||||
|
|
||||||
|
print("dx: " + euler.x);
|
||||||
|
|
||||||
// Adjust body yaw by roll from controller
|
// Adjust body yaw by roll from controller
|
||||||
var orientation = Quat.multiply(Quat.angleAxis(((euler.y * GRAB_CONTROLLER_YAW_SCALING) +
|
var orientation = Quat.multiply(Quat.angleAxis(((euler.y * YAW_SCALING) +
|
||||||
(euler.z * GRAB_CONTROLLER_ROLL_SCALING)) * deltaTime, {x:0, y: 1, z:0}), MyAvatar.orientation);
|
(euler.z * ROLL_SCALING)) * deltaTime, {x:0, y: 1, z:0}), MyAvatar.orientation);
|
||||||
MyAvatar.orientation = orientation;
|
MyAvatar.orientation = orientation;
|
||||||
|
|
||||||
// Adjust head pitch from controller
|
// Adjust head pitch from controller
|
||||||
MyAvatar.headPitch = MyAvatar.headPitch + (euler.x * GRAB_CONTROLLER_PITCH_SCALING * deltaTime);
|
var pitch = 0.0;
|
||||||
|
if (Math.abs(euler.x) > PITCH_DEAD_ZONE) {
|
||||||
// Add some camera roll proportional to the rate of turn (so it feels like an airplane or roller coaster)
|
pitch = (euler.x < 0.0) ? (euler.x + PITCH_DEAD_ZONE) : (euler.x - PITCH_DEAD_ZONE);
|
||||||
|
}
|
||||||
|
MyAvatar.headPitch = MyAvatar.headPitch + (pitch * PITCH_SCALING * deltaTime);
|
||||||
|
|
||||||
|
// TODO: Add some camera roll proportional to the rate of turn (so it feels like an airplane or roller coaster)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue