I’m trying to achieve a growing effect for meshes. The mesh would having a starting scale, then gradually move toward a larger scale over time. I searched the documentation and forum, but I didn’t find any examples of this.
Any suggestions or recommendations would be greatly appreciated!
What about using linear interpolation?
Yep, this seems like the right approach, but I’m not exactly sure how to apply it to meshes (I didn’t see any mesh scaling in the lerpToRef examples ).
For example, if I wanted to scale “meshName” from 0.4 to 0.8, would this be somewhat close?
BABYLON.meshName.Vector3.lerptoref(BABYLON.Vector3(0.4, 0.4, 0.4),
BABYLON.Vector3(0.8, 0.8, 0.8), 0.5, **result??**).
I assume the 3rd value (0.5) would just control how quickly it scales. I have no idea what the final “result” value should be.
Thanks for the help!
You can do it like the following:
Clamping amount to 1, as everything above will start extrapolating the vector.
Another way of doing it would be:
This way you don’t have to keep track of the amount, as you interpolate from the Current scaling vector. This results in a noticeable slowdown due to the distance getting smaller while having a fixed interpolation-amount.
You can even combine the two:
Perfect! Thanks for taking the time to help!