(script) User Object?

28 views
Skip to first unread message

Stiev Stigma

unread,
Jan 12, 2017, 1:22:28 AM1/12/17
to CoSpaces
Really diggin' the app thus far. Just was wondering if there is a way to target the user with a method like so: user.MoveTo(3,3);
Being able to move the user within a space and also set/read position and properties would be very useful I think.


benj...@delightex.com

unread,
Jan 12, 2017, 8:58:05 AM1/12/17
to CoSpaces
Hi Stiev,

yes you can use the item.moveTo() method to move an item in space. You can call it with 2, 3, or 4 arguments.

item.moveTo(xPos, yPos)
item.moveTo(xPos, yPos, zPos)
item.moveTo(xPos, yPos, zPos, callback)

Example:

var man = Space.createItem('LP_Man', 0, 0, 0);
man.moveTo(3, 4);

To set the position of an item use the item.setPosition() method.

man.setPosition(7, -2, 3);

Similarly to get the position of an item use item.getPosition().

var newPos = man.getPosition(); // returns an object => {x: 7, y: -2, z: 3}

Check out the API documentation and the CoSpaces Scripting Google Group if you want to learn more.

Thank you!
Benjamin
Reply all
Reply to author
Forward
0 new messages