mirror of
https://github.com/overte-org/overte.git
synced 2025-08-10 00:13:29 +02:00
Merge pull request #2918 from PhilipRosedale/master
Ability to move both slowly and fast with hand controllers
This commit is contained in:
commit
fb7db04573
1 changed files with 13 additions and 11 deletions
|
@ -78,7 +78,7 @@ function createDebugOverlay() {
|
||||||
position: defaultPosition,
|
position: defaultPosition,
|
||||||
size: RADIUS,
|
size: RADIUS,
|
||||||
color: GRAY_COLOR,
|
color: GRAY_COLOR,
|
||||||
alpha: 1,
|
alpha: 0.75,
|
||||||
visible: true,
|
visible: true,
|
||||||
solid: true,
|
solid: true,
|
||||||
anchor: "MyAvatar"
|
anchor: "MyAvatar"
|
||||||
|
@ -87,7 +87,7 @@ function createDebugOverlay() {
|
||||||
position: defaultPosition,
|
position: defaultPosition,
|
||||||
size: RADIUS,
|
size: RADIUS,
|
||||||
color: RED_COLOR,
|
color: RED_COLOR,
|
||||||
alpha: 1,
|
alpha: 0.5,
|
||||||
visible: true,
|
visible: true,
|
||||||
solid: true,
|
solid: true,
|
||||||
anchor: "MyAvatar"
|
anchor: "MyAvatar"
|
||||||
|
@ -111,7 +111,7 @@ function displayDebug() {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// update debug indicator
|
// update debug indicator
|
||||||
if (greenSphere == -1) {
|
if (greenSphere == -1) {
|
||||||
createDebugOverlay();
|
createDebugOverlay();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -149,8 +149,8 @@ function getGrabRotation() {
|
||||||
// When move button is pressed, process results
|
// When move button is pressed, process results
|
||||||
function handleGrabBehavior(deltaTime) {
|
function handleGrabBehavior(deltaTime) {
|
||||||
// check for and handle grab behaviors
|
// check for and handle grab behaviors
|
||||||
grabbingWithRightHand = Controller.isButtonPressed(RIGHT_BUTTON_FWD) || Controller.isButtonPressed(RIGHT_BUTTON_4);
|
grabbingWithRightHand = Controller.isButtonPressed(RIGHT_BUTTON_4);
|
||||||
grabbingWithLeftHand = Controller.isButtonPressed(LEFT_BUTTON_FWD) || Controller.isButtonPressed(LEFT_BUTTON_4);
|
grabbingWithLeftHand = Controller.isButtonPressed(LEFT_BUTTON_4);
|
||||||
stoppedGrabbingWithLeftHand = false;
|
stoppedGrabbingWithLeftHand = false;
|
||||||
stoppedGrabbingWithRightHand = false;
|
stoppedGrabbingWithRightHand = false;
|
||||||
|
|
||||||
|
@ -201,20 +201,22 @@ function handleGrabBehavior(deltaTime) {
|
||||||
printVector("grabDelta: ", grabDelta, 3);
|
printVector("grabDelta: ", grabDelta, 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
var THRUST_GRAB_SCALING = 300000.0;
|
var thrust = Vec3.multiply(grabDelta, Math.abs(Vec3.length(grabDelta)));
|
||||||
|
|
||||||
|
var THRUST_GRAB_SCALING = 100000.0;
|
||||||
|
|
||||||
var thrustFront = Vec3.multiply(front, MyAvatar.scale * -grabDelta.z * THRUST_GRAB_SCALING * deltaTime);
|
var thrustFront = Vec3.multiply(front, MyAvatar.scale * -thrust.z * THRUST_GRAB_SCALING * deltaTime);
|
||||||
MyAvatar.addThrust(thrustFront);
|
MyAvatar.addThrust(thrustFront);
|
||||||
var thrustRight = Vec3.multiply(right, MyAvatar.scale * grabDelta.x * THRUST_GRAB_SCALING * deltaTime);
|
var thrustRight = Vec3.multiply(right, MyAvatar.scale * thrust.x * THRUST_GRAB_SCALING * deltaTime);
|
||||||
MyAvatar.addThrust(thrustRight);
|
MyAvatar.addThrust(thrustRight);
|
||||||
var thrustUp = Vec3.multiply(up, MyAvatar.scale * grabDelta.y * THRUST_GRAB_SCALING * deltaTime);
|
var thrustUp = Vec3.multiply(up, MyAvatar.scale * thrust.y * THRUST_GRAB_SCALING * deltaTime);
|
||||||
MyAvatar.addThrust(thrustUp);
|
MyAvatar.addThrust(thrustUp);
|
||||||
|
|
||||||
// add some rotation...
|
// add some rotation...
|
||||||
var deltaRotation = getGrabRotation();
|
var deltaRotation = getGrabRotation();
|
||||||
var PITCH_SCALING = 2.0;
|
var PITCH_SCALING = 2.5;
|
||||||
var PITCH_DEAD_ZONE = 2.0;
|
var PITCH_DEAD_ZONE = 2.0;
|
||||||
var YAW_SCALING = 2.0;
|
var YAW_SCALING = 2.5;
|
||||||
var ROLL_SCALING = 2.0;
|
var ROLL_SCALING = 2.0;
|
||||||
|
|
||||||
var euler = Quat.safeEulerAngles(deltaRotation);
|
var euler = Quat.safeEulerAngles(deltaRotation);
|
||||||
|
|
Loading…
Reference in a new issue