Skip to content

Instantly share code, notes, and snippets.

@hyperlogic
hyperlogic / debugatar.js
Last active September 18, 2018 22:25
debugatar avatar debug script for high fidelity
//
// debugatar.js
//
/* eslint indent: ["error", 4, { "outerIIFEBody": 0 }] */
(function() { // BEGIN LOCAL_SCOPE
var TABLET_BUTTON_NAME = "DEBUGATAR";
var DEBUG_AVATAR_URL = "https://s3.amazonaws.com/hifi-public/tony/html/debugAvatar.html?2";
(require 'cl-lib)
;; quaternions are expected to be a list of four elements
;; '(x y z w), w is the real part of the quaternion and
;; x y z are the i j k imaginary elements
(defun ajt-quat-to-axis-angle (q)
(let ((qx (car q)) (qy (cadr q)) (qz (caddr q)) (qw (cadddr q)))
(let ((angle (* 2.0 (acos qw)))
(s (- 1.0 (* qw qw))))
/* global Xform */
Script.include("/~/system/libraries/Xform.js");
var WHITE = {x: 1, y: 1, z: 1, w: 1};
var IDENT = {x: 0, y: 0, z: 0, w: 1};
function drawOtherAvatarHands() {
var avatars = AvatarList.getAvatarIdentifiers();
avatars.forEach(function (id) {
var avatar = AvatarList.getAvatar(id);
if (MyAvatar.sessionUUID !== avatar.sessionUUID) {
var triggerPressHandled = false;
var rightTriggerPressed = false;
var leftTriggerPressed = false;
var TRIGGER_MAPPING_NAME = "com.highfidelity.headTrace.triggers";
var triggerMapping = Controller.newMapping(TRIGGER_MAPPING_NAME);
triggerMapping.from([Controller.Standard.RTClick]).peek().to(function (value) {
rightTriggerPressed = (value !== 0) ? true : false;
});
triggerMapping.from([Controller.Standard.LTClick]).peek().to(function (value) {
/* global Xform */
Script.include("/~/system/libraries/Xform.js");
var ANIM_VARS = [
"isTalking",
"isNotMoving",
"isMovingForward",
"isMovingBackward",
"isMovingRight",
"isMovingLeft",
https://hifi-content.s3.amazonaws.com/ozan/dev/avatars/hifi_team/philip/sss/philip.fst
//
// Interaction.js
// scripts/interaction
//
// Created by Trevor Berninger on 3/20/17.
// Copyright 2017 Limitless ltd.
//
// Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//
//
// NPCHelpers.js
// scripts/interaction
//
// Created by Trevor Berninger on 3/20/17.
// Copyright 2017 Limitless ltd.
//
// Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//
//
// NPC_AC.js
// scripts/interaction
//
// Created by Trevor Berninger on 3/20/17.
// Copyright 2017 Limitless ltd.
//
// Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//
function mirrorRot(q) {
return {x: q.x, y: -q.y, z: -q.z, w: q.w};
}
function mirrorPos(p) {
return {x: -p.x, y: p.y, z: p.z}
}
var mirrorMapping = Controller.newMapping();