跳跃运动 JS,音高未定义

leap motion JS, pitch undefined

我有一些 hello world 使用 nodeJS 跳跃运动发生

我想知道一手牌的音高值,但正在返回 "undefined"

var Leap = require('leapjs');

var webSocket = require('ws'),
    ws = new webSocket('ws://127.0.0.1:6437');

ws.on('message', function(data, flags) {
    frame = JSON.parse(data); 

var controller = Leap.loop(function(frame){

    if(frame.hands.length == 1)
    {
        var hand = frame.hands[0];
        var position = hand.palmPosition;
        var velocity = hand.palmVelocity;
        var direction = hand.direction;
        var finger = hand.fingers[0];
        var pitch = direction.pitch;

        var type = hand.type;
        if(type == "left"){
            console.log("Left hand.");
            console.log("pitch ::"+pitch);
        } 

        if(type == "right") {
            console.log("Right hand.")
        }
    }
    });


    if (frame.hands && frame.hands.length > 1) {
        console.log("two");
    }    
    if (frame.hands && frame.hands.length == 0) {  
            console.log("apaga too");
    }
});

所以,当我记录我的左手时,我得到

Left hand. pitch ::undefined

我认为pitch是属于手而不是方向的方法,不是属于方向的属性docs。您尝试过 hand.pitch() 吗?