Set Entity Position using Variables


#1

How do I set entity position using Variables?
For instance see below… but this does not work.

var a = 10;
var coord = ‘{x:’ + a + ‘,y:2,z:3}’;
print("coord: " + coord); //looks good

// add entity 
var house = "http://www.xyz.net/3D/house1.fbx";
var properties = {
    type: "Model",
    modelURL: house,
    position: coord
};

entityID = Entities.addEntity(properties);


#2

In the script, the coord value is being set to a string value (because of the "’"s). It should instead be set to an object value …

var coord = { x: a, y: 2, z: 3 };
print("coord" + JSON.stringify(coord));

#3

Thank you! Was overthinking it .