Skip to content

Instantly share code, notes, and snippets.

@thoys
Created June 19, 2015 23:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thoys/b8ea5852b8738f7c64ff to your computer and use it in GitHub Desktop.
Save thoys/b8ea5852b8738f7c64ff to your computer and use it in GitHub Desktop.
var i = 0;
Script.setInterval(function() {
i += Math.random();
MyAvatar.setJointData("LeftHand", Quat.fromPitchYawRollDegrees(0, 180 + Math.abs((i % 120) - 60), 0));
MyAvatar.setJointData("RightHand", Quat.fromPitchYawRollDegrees(0, 180 - Math.abs((i % 120) - 60), 0));
MyAvatar.setJointData("LeftArm", Quat.fromPitchYawRollDegrees(0, 0, Math.abs(((i + 50) % 120) - 60)));
MyAvatar.setJointData("RightArm", Quat.fromPitchYawRollDegrees(0, 0, -Math.abs((i % 120) - 60)));
MyAvatar.setJointData("LeftForeArm", Quat.fromPitchYawRollDegrees( -Math.abs((i % 120) - 60), 0, 0));
MyAvatar.setJointData("RightForeArm", Quat.fromPitchYawRollDegrees( -Math.abs((i % 120) - 60), 0, 0));
//MyAvatar.setJointData("Head", Quat.fromPitchYawRollDegrees(Math.abs((i - 120) % 240) , Math.abs((i - 120) % 240), Math.abs((i - 120) % 240)));
MyAvatar.setJointData("LeftLeg", Quat.fromPitchYawRollDegrees( -Math.abs((i % 120) - 60), 0, 0));
MyAvatar.setJointData("RightLeg", -Quat.fromPitchYawRollDegrees( Math.abs((i % 120) - 60), 0, 0));
}, 0.05);
Script.scriptEnding.connect(function() {
var zeroRotation = Quat.fromPitchYawRollDegrees(0, 0, 0);
for (var jointName in MyAvatar.jointNames) {
print(jointName);
MyAvatar.setJointData(jointName, zeroRotation);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment