I have a GLTF model loaded in my canvas. I added a function that moves the object back and forth after pressing a 2D button:
function move() {
if(mesh2 && (mesh2.position.y >= 200)) {
mesh2.position.y -= 100;
} else {
mesh2.position.y += 100;
}
}
Instead of doing a smooth animation, the objects just jumps to the other position instantly.
How do I toggle a position animation after a button press?