【问题标题】:leap motion JS, pitch undefined跳跃运动JS,音高未定义
【发布时间】:2015-03-21 22:40:53
【问题描述】:

我有一些使用 nodeJS 的跳跃运动发生的你好世界

我想知道一手牌的音高值,但返回“未定义”

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");
    }
});

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

左手。 音调::未定义

【问题讨论】:

    标签: node.js leap-motion


    【解决方案1】:

    我相信音高是属于手而不是方向的方法,不是属于方向docs的属性。你试过hand.pitch() 吗?

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-04-29
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-03-23
      • 1970-01-01
      相关资源
      最近更新 更多