mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-29 22:22:54 +02:00
no teleport while moving
This commit is contained in:
parent
88ebeaa4cb
commit
364eb992fb
1 changed files with 6 additions and 22 deletions
|
@ -594,10 +594,6 @@ function getAvatarSpeed() {
|
||||||
return Vec3.length(MyAvatar.velocity)
|
return Vec3.length(MyAvatar.velocity)
|
||||||
}
|
}
|
||||||
|
|
||||||
function hasPressedMovementButtonLately() {
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var leftPad = new ThumbPad('left');
|
var leftPad = new ThumbPad('left');
|
||||||
var rightPad = new ThumbPad('right');
|
var rightPad = new ThumbPad('right');
|
||||||
|
@ -609,20 +605,11 @@ var mappingName, teleportMapping;
|
||||||
var activationTimeout = null;
|
var activationTimeout = null;
|
||||||
var TELEPORT_DELAY = 800;
|
var TELEPORT_DELAY = 800;
|
||||||
|
|
||||||
var lastMovementPress = new Date();
|
function isMoving() {
|
||||||
|
|
||||||
function pressedAMovementButton() {
|
var LY = Controller.getValue(Controller.Standard.LY);
|
||||||
print('PRESSED A MOVEMENT BUTTON!!')
|
var LX = Controller.getValue(Controller.Standard.LX);
|
||||||
lastMovementPress = new Date();
|
if (LY !== 0 || LX !== 0) {
|
||||||
}
|
|
||||||
|
|
||||||
function hasMovedRecently() {
|
|
||||||
var dif = new Date().getTime() - lastMovementPress.getTime();
|
|
||||||
|
|
||||||
var secondsBetween = dif / 1000;
|
|
||||||
secondsBetween = Math.abs(secondsBetween);
|
|
||||||
print('seconds between: '+secondsBetween)
|
|
||||||
if (secondsBetween < 0.5) {
|
|
||||||
return true
|
return true
|
||||||
} else {
|
} else {
|
||||||
return false
|
return false
|
||||||
|
@ -638,9 +625,6 @@ function registerMappings() {
|
||||||
teleportMapping.from(Controller.Standard.RightPrimaryThumb).peek().to(rightPad.buttonPress);
|
teleportMapping.from(Controller.Standard.RightPrimaryThumb).peek().to(rightPad.buttonPress);
|
||||||
teleportMapping.from(Controller.Standard.LeftPrimaryThumb).peek().to(leftPad.buttonPress);
|
teleportMapping.from(Controller.Standard.LeftPrimaryThumb).peek().to(leftPad.buttonPress);
|
||||||
|
|
||||||
teleportMapping.from(Controller.Standard.LY).peek().to(pressedAMovementButton);
|
|
||||||
teleportMapping.from(Controller.Standard.LX).peek().to(pressedAMovementButton);
|
|
||||||
|
|
||||||
teleportMapping.from(Controller.Standard.LeftPrimaryThumb)
|
teleportMapping.from(Controller.Standard.LeftPrimaryThumb)
|
||||||
.to(function(value) {
|
.to(function(value) {
|
||||||
if (isDisabled === 'left' || isDisabled === 'both') {
|
if (isDisabled === 'left' || isDisabled === 'both') {
|
||||||
|
@ -652,7 +636,7 @@ function registerMappings() {
|
||||||
if (leftTrigger.down()) {
|
if (leftTrigger.down()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (hasMovedRecently() === true) {
|
if (isMoving() === true) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// if (getAvatarSpeed() >= MAX_AVATAR_SPEED) {
|
// if (getAvatarSpeed() >= MAX_AVATAR_SPEED) {
|
||||||
|
@ -676,7 +660,7 @@ function registerMappings() {
|
||||||
if (rightTrigger.down()) {
|
if (rightTrigger.down()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (hasMovedRecently() === true) {
|
if (isMoving() === true) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// if (getAvatarSpeed() >= MAX_AVATAR_SPEED) {
|
// if (getAvatarSpeed() >= MAX_AVATAR_SPEED) {
|
||||||
|
|
Loading…
Reference in a new issue