content/hifi-content/lincoln/stickScript.js
2022-02-14 02:04:11 +01:00

35 lines
No EOL
845 B
JavaScript

(function() {
var _this;
function scale(value, min1, max1, min2, max2) {
return min2 + (max2 - min2) * ((value - min1) / (max1 - min1));
}
Stick = function() {
_this = this;
}
Stick.prototype = {
collisionWithEntity: function(EntityItemID,EntityItem2ID,Collision) {
print("stick collided")
if (Collision.type !== 0) {
return
}
var magnitude = Vec3.length(Collision.velocityChange)
var myProps = Entities.getEntityProperties(EntityItemID);
// var hand = myProps.description;
// hand = hand === 'left' ? 0 : 1;
// vibrateControllers(magnitude, hand) // both
var vibrated = Controller.triggerHapticPulse(1, 20, 2);
}
}
return new Stick();
})