mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-05-06 17:58:36 +02:00
JavaScript changes: * removed MyAvatar.playAnimation * removed MyAvatar.stopAnimation * removed MyAVatar.getGetAnimationDetails * removed MyAvatar.startAnimationByRole * removed MyAvatar.stopAnimationByRole * removed MyAVatar.getGetAnimationDetailsByRole * removed MyAVatar.clearJointPriorities * added MyAvatar.overrideAnimation(url, fps, loop, firstFrame, lastFrame) * added MyAvatar.restoreAnimation() * added MyAvatar.getAnimationRoles() * added MyAvatar.overrideRoleAnimation(role, url, fps, loop, firstFrame, lastFrame) * added MyAvatar.restoreRoleAnimation(role) * added MyAvatar.prefetchAnimation(url) * update kneel.js with new api. * added theBird.js to test role override api. C++ changes: * Added getParent() and replaceChild() to AnimNode * Added findByName() and traverse() to AnimNode * Changed AnimStateMachine to hold nodes by childIndex instead of smart pointer. This allows script to replace nodes dynamically via overrideRoleAnimation
32 lines
1.1 KiB
JavaScript
32 lines
1.1 KiB
JavaScript
//
|
|
// theBird.js
|
|
// examples
|
|
//
|
|
// Created by Anthony Thibault on 11/9/2015
|
|
// Copyright 2015 High Fidelity, Inc.
|
|
//
|
|
// Distributed under the Apache License, Version 2.0.
|
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
|
//
|
|
// Example of how to play an animation on an avatar.
|
|
//
|
|
|
|
var THE_BIRD_RIGHT_URL = "https://hifi-public.s3.amazonaws.com/ozan/anim/the_bird/the_bird_right.fbx";
|
|
|
|
var roles = MyAvatar.getAnimationRoles();
|
|
var i, l = roles.length
|
|
print("getAnimationRoles()");
|
|
for (i = 0; i < l; i++) {
|
|
print(roles[i]);
|
|
}
|
|
|
|
// replace point with the bird!
|
|
MyAvatar.overrideRoleAnimation("rightHandPointIntro", THE_BIRD_RIGHT_URL, 30, false, 0, 12);
|
|
MyAvatar.overrideRoleAnimation("rightHandPointHold", THE_BIRD_RIGHT_URL, 30, false, 12, 12);
|
|
MyAvatar.overrideRoleAnimation("rightHandPointOutro", THE_BIRD_RIGHT_URL, 30, false, 19, 30);
|
|
|
|
Script.scriptEnding.connect(function() {
|
|
MyAvatar.restoreRoleAnimation("rightHandPointIntro");
|
|
MyAvatar.restoreRoleAnimation("rightHandPointHold");
|
|
MyAvatar.restoreRoleAnimation("rightHandPointOutro");
|
|
});
|