Created
October 31, 2019 23:21
-
-
Save hyperlogic/ae739c923e81f52e5c81153a86c18694 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var normalizedMousePos = {x: 0, y: 0}; | |
function animHandler(props) { | |
props.lookAroundAlpha = {x: normalizedMousePos.x, y: -normalizedMousePos.y, z: 0}; | |
return props; | |
} | |
Controller.mouseMoveEvent.connect(function (e) { | |
normalizedMousePos.x = ((2 * e.x) / Window.innerWidth) - 1; | |
normalizedMousePos.y = ((2 * e.y) / Window.innerHeight) - 1; | |
}); | |
animHandlerId = MyAvatar.addAnimationStateHandler(animHandler, ["lookAroundAlpha"]); | |
Script.scriptEnding.connect(function () { | |
MyAvatar.removeAnimationStateHandler(animHandlerId); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment