Enhancing the Experience With JavaScript API

You can use JavaScript API to further enhance your experience.

In this topic, you can find several basic examples of JavaScript usage for humans.

  1. To replay an existing human animation, use the following piece of code: myHumanActor.startAnimation(animationName);
    Note: animationName corresponds to the animation’s name as defined in Human Animation Studio. By default, the first animation created in Human Animation Studio is named Animation.1 . For more information, see Human Animation Studio User's Guide.
  2. To move body parts, use one or more pieces of code:
    ActionCode
    Get the position and orientation of right arm myHumanActor.skeleton.getIKTransform(STU.HumanSkeleton.EIKMember.eRightArm, iReferential)
    Set the position and orientation of left leg myHumanActor.skeleton.setIKTransform(STU.HumanSkeleton.EIKMember.eLeftLeg, newtransfo, iReferential, iUpdateSkinning)
    Change the head orientation myHumanActor.skeleton.setLookAtPosition(newPosition, iReferential, iUpdateSkinning)