Creating in-game animation by using translate

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:

A more complex way for a smoother animation is to use a pc.Curve:

And another way is to use the PlayCanvas Tween library:

1 Like

Thanks, Iā€™m going to try that out later :+1:

1 Like

Additionally check out this tween component to control tweens via a script component. It wraps up the methods @Leonidas mentioned.