mirror of
https://github.com/Armored-Dragon/overte.git
synced 2025-03-11 16:13:16 +01:00
end of day
This commit is contained in:
parent
fd062d09dc
commit
4b4e38a57c
1 changed files with 103 additions and 26 deletions
|
@ -14,8 +14,6 @@
|
||||||
|
|
||||||
//parabola: point count, point spacing, graphic thickness
|
//parabola: point count, point spacing, graphic thickness
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//Standard.LeftPrimaryThumb
|
//Standard.LeftPrimaryThumb
|
||||||
//Standard.LT
|
//Standard.LT
|
||||||
|
|
||||||
|
@ -24,40 +22,119 @@
|
||||||
var teleportMapping = Controller.newMapping('Hifi-Teleporter-Dev-' + Math.random());
|
var teleportMapping = Controller.newMapping('Hifi-Teleporter-Dev-' + Math.random());
|
||||||
Script.scriptEnding.connect(teleportMapping.disable);
|
Script.scriptEnding.connect(teleportMapping.disable);
|
||||||
|
|
||||||
// Gather the trigger data for smoothing.
|
// peek at the trigger and thumbs to store their values
|
||||||
clickMapping.from(Controller.Standard.RT).peek().to(rightTrigger.triggerPress);
|
teleportMapping.from(Controller.Standard.RT).peek().to(rightTrigger.buttonPress);
|
||||||
clickMapping.from(Controller.Standard.LT).peek().to(leftTrigger.triggerPress);
|
teleportMapping.from(Controller.Standard.LT).peek().to(leftTrigger.buttonPress);
|
||||||
|
teleportMapping.from(Controller.Standard.RightPrimaryThumb).peek().to(rightPad.buttonPress);
|
||||||
|
teleportMapping.from(Controller.Standard.LeftPrimaryThumb).peek().to(leftPad.buttonPress);
|
||||||
|
|
||||||
|
|
||||||
|
function ThumbPad() {
|
||||||
function thumbPad() {
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
thumbPad.prototype = {
|
ThumbPad.prototype = {
|
||||||
down: function() {
|
buttonPress: function(value) {
|
||||||
return this.padValue === 0 ? true : false;
|
print('pad press: ' + value)
|
||||||
}
|
this.buttonValue = value;
|
||||||
}
|
|
||||||
|
|
||||||
function trigger() {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
trigger.prototype = {
|
|
||||||
triggerPress: function(value) {
|
|
||||||
this.triggerValue = value;
|
|
||||||
},
|
},
|
||||||
down: function() {
|
down: function() {
|
||||||
return this.triggerValue === 0 ? true : false;
|
return this.buttonValue === 0 ? true : false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function Trigger() {
|
||||||
teleportMapping.from(thumbPad.down).when(trigger.down).to(teleport);
|
|
||||||
|
|
||||||
function teleport() {
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function() {}
|
Trigger.prototype = {
|
||||||
|
buttonPress: function(value) {
|
||||||
|
print('trigger press: ' + value)
|
||||||
|
this.buttonValue = value;
|
||||||
|
},
|
||||||
|
down: function() {
|
||||||
|
return this.buttonValue === 0 ? true : false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
teleportMapping.from(leftPad.down).when(leftTrigger.down).to(teleporter.enterTeleportMode);
|
||||||
|
teleportMapping.from(rightPad.down).when(rightTrigger.down).to(teleporter.enterTeleportMode);
|
||||||
|
|
||||||
|
|
||||||
|
function Teleporter() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
Teleporter.prototype = {
|
||||||
|
enterTeleportMode: function(value) {
|
||||||
|
print('value on enter: ' + value);
|
||||||
|
},
|
||||||
|
exitTeleportMode: function(value) {
|
||||||
|
print('value on exit: ' + value);
|
||||||
|
},
|
||||||
|
teleport: function(value) {
|
||||||
|
//todo
|
||||||
|
//get the y position of the teleport landing spot
|
||||||
|
print('value on teleport: ' + value)
|
||||||
|
var properties = Entities.getEntityProperties(_this.entityID);
|
||||||
|
var offset = getAvatarFootOffset();
|
||||||
|
properties.position.y += offset;
|
||||||
|
|
||||||
|
print('OFFSET IS::: ' + JSON.stringify(offset))
|
||||||
|
print('TELEPORT POSITION IS:: ' + JSON.stringify(properties.position));
|
||||||
|
MyAvatar.position = properties.position;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function getAvatarFootOffset() {
|
||||||
|
var data = getJointData();
|
||||||
|
var upperLeg, lowerLeg, foot, toe, toeTop;
|
||||||
|
data.forEach(function(d) {
|
||||||
|
|
||||||
|
var jointName = d.joint;
|
||||||
|
if (jointName === "RightUpLeg") {
|
||||||
|
upperLeg = d.translation.y;
|
||||||
|
}
|
||||||
|
if (jointName === "RightLeg") {
|
||||||
|
lowerLeg = d.translation.y;
|
||||||
|
}
|
||||||
|
if (jointName === "RightFoot") {
|
||||||
|
foot = d.translation.y;
|
||||||
|
}
|
||||||
|
if (jointName === "RightToeBase") {
|
||||||
|
toe = d.translation.y;
|
||||||
|
}
|
||||||
|
if (jointName === "RightToe_End") {
|
||||||
|
toeTop = d.translation.y
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
var myPosition = MyAvatar.position;
|
||||||
|
var offset = upperLeg + lowerLeg + foot + toe + toeTop;
|
||||||
|
offset = offset / 100;
|
||||||
|
return offset
|
||||||
|
};
|
||||||
|
|
||||||
|
function getJointData() {
|
||||||
|
var allJointData = [];
|
||||||
|
var jointNames = MyAvatar.jointNames;
|
||||||
|
jointNames.forEach(function(joint, index) {
|
||||||
|
var translation = MyAvatar.getJointTranslation(index);
|
||||||
|
var rotation = MyAvatar.getJointRotation(index)
|
||||||
|
allJointData.push({
|
||||||
|
joint: joint,
|
||||||
|
index: index,
|
||||||
|
translation: translation,
|
||||||
|
rotation: rotation
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
return allJointData;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
var leftPad = new ThumbPad();
|
||||||
|
var rightPad = new ThumbPad();
|
||||||
|
var leftTrigger = new Trigger();
|
||||||
|
var rightTrigger = new Trigger();
|
||||||
|
var teleporter = new Teleporter();
|
Loading…
Reference in a new issue