Javascript Facebook ARStudio:如何设置对象位置?

Javascript Facebook ARStudio:如何设置对象位置?,javascript,facebook,augmented-reality,spark-ar-studio,Javascript,Facebook,Augmented Reality,Spark Ar Studio,我从Facebook开始尝试ARStudio,但我不知道如何通过脚本设置对象的位置。 我尝试了下面的方法,但似乎object.transform.x(或y,z)采用“ScalarSignal”而不是数值。如何设置ARStudio中对象的位置 class Vector3{ constructor(xPos = 0, yPos = 0, zPos = 0){ var x = xPos; var y = yPos; var z = zPos;

我从Facebook开始尝试ARStudio,但我不知道如何通过脚本设置对象的位置。 我尝试了下面的方法,但似乎
object.transform.x(或y,z)
采用“ScalarSignal”而不是数值。如何设置ARStudio中对象的位置

class Vector3{
    constructor(xPos = 0, yPos = 0, zPos = 0){
        var x = xPos;
        var y = yPos;
        var z = zPos;
    }
}

const FaceTracking = require("FaceTracking");
const Diagnostics = require("Diagnostics");
const Scene = require("Scene");

var sphere = Scene.root.child("sphere");
var spherePosition = new Vector3()

var mouthCenter = FaceTracking.face(0).mouth.center;
var mouthCenterPosition = new Vector3();

mouthCenter.x.monitor().subscribe(function(e){
    if(e.newValue){
        mouthCenterPosition.x = mouthCenter.x.lastValue;
    }
});

mouthCenter.y.monitor().subscribe(function(e){
    if(e.newValue){
        mouthCenterPosition.y = mouthCenter.y.lastValue;
    }
});

mouthCenter.z.monitor().subscribe(function(e){
    if(e.newValue){
        mouthCenterPosition.z = mouthCenter.z.lastValue;
    }
    // Diagnostics.log(mouthCenterPosition);
    SetSpherePosition(mouthCenterPosition);
});

function SetSpherePosition(pos){
    //This part is causing error...
    sphere.transform.x = pos.x;
    sphere.transform.y = pos.y;
    sphere.transform.z = pos.z;
}
这可能有助于:

另外,尝试以下方法

sphere.transform.position = mouthCenterPosition; 
我认为sphere对象可能包含这个transform模块,然后可以修改它的position属性。我相信这样设置一个相等值就是如何“绑定”反应。我是新的反应,任何关于这个答案的其他帮助我也将不胜感激