Move mesh from point A to B

Hi,

I need to move a mesh from position A to position B over the time for an automatic animation. What would be the best option to animate the mesh movement?

Thank you

Animation is a really nice and easy way:
https://www.babylonjs-playground.com/#CBGEQX#43

https://doc.babylonjs.com/babylon101/animations

Thank you! I’ll play around it.

Regards

Hi R. That goofy Wingnut guy made some “overload” animation functions for mesh-class objects.

https://www.babylonjs-playground.com/#HH1U5#73

Overload funcs are “wedged-into” mesh-class objects… in lines 2-31. They are not very powerful or versatile, but they are VERY easy to use.

Currently, the animations are time-triggered by a “script-of-events” in lines 129-169. A scheduled event looks like: setTimeout(()=>box1.move("y", 8, 25), 32000); This means… move box1 +8 units on its Y axis… at a speed of 25… starting the anim about 32 seconds after first render frame. Easy, huh?

Overloading BJS MESH-class objects is not recommended or wise, but these little move and spin functions… can be stand-alone normal funcs such as mySpinner([assorted params]) and myMover(etc).

Seems to work ok. No keyframes to set… easing in/out already installed… quickie animation tools - thanks to the handy BABYLON.Animation.CreateAndStartAnimation() feature. Love it!

Note: I DON’T THINK CreateAndStartAnimation() allows a “callback function” such as an onAnimationFinished parameter. If you need an onEnded callback, you might need to use a different type of animation-creating. Party on.

1 Like