I want to have a sliding door that goes up, when you push a button.
Can I only set two coordinates, so that my game would interpolate in between those two translations for e.g. 2 secs?
Thanks in advance
I want to have a sliding door that goes up, when you push a button.
Can I only set two coordinates, so that my game would interpolate in between those two translations for e.g. 2 secs?
Thanks in advance
Hi @SayHiToMePls,
Yes, you can use the lerp method inside update on the pc.Vec3 class to do that:
https://developer.playcanvas.com/api/pc.Vec3.html#lerp
A more complex way for a smoother animation is to use a pc.Curve:
https://developer.playcanvas.com/en/tutorials/animate-entities-with-curves/
And another way is to use the PlayCanvas Tween library:
Thanks, Iām going to try that out later
Additionally check out this tween component to control tweens via a script component. It wraps up the methods @Leonidas mentioned. https://github.com/playcanvas/engine/blob/dev/scripts/animation/tween.js