Tweening a 3d object in xyz space

I have an object that I’m tweening:

.to({x: 0, y: -0.0015, z: 0}, 50, pc.SineOut)

now whatever digits i enter for the x y z doesn’t seem to quite work… So if i put 1 in for y i would expect it to move in the y plane 1 unit? is that right?

Hi @jono3d,

The x, y, z coordinates that you provide are the target end points of the object you are tweening in local space. So if you want to move from (1,1,1) to (5,5,5) you would pass (5,5,5) instead of (4,4,4).

In your case if you want to move one unit on the Y axis from (1,1,1), it would be (1,2,1).

A property that you pass to the .to() method needs to be an instance of some PlayCanvas object, like pc.Vec3():

var to = new pc.Vec3({x: 0, y: 1, z: 0});
.to(to, 5, pc.SineOut)

User Guide:

Actually they don’t have to… Hmm. Should be working. Make sure your time value is not too long, e.g. 50 seconds to move 0.001 meter - it will look like it stands in place.