Hi,
Is there any way to make a self-playable action? My case is:
- I have a Coin, and I added an ExecuteCodeAction when the player intersects it. But I want to, after it, interpolate the coin.poisition.y to a higher value, to simulate the effect of “coin fastly bring to up”.
I tried adding the Interpolate on .then, but I noticed on documentation that the actions on .then are fired only when the first action trigger is repeated.
What is the best way to make the “coin.position.y” interpolation starts after the player gets the coin?
I was thinking about a way to make an auto-playable action to call it on the first action callback. Is it possible?
Thanks very much by helping
My current code is:
coin.actionManager.registerAction(
new BABYLON.ExecuteCodeAction(
{
trigger: BABYLON.ActionManager.OnIntersectionEnterTrigger,
parameter: playerMesh
},
() => {
console.log('here')
this.player.keepCoin()
}
)
).then(
new BABYLON.InterpolateValueAction(
BABYLON.ActionManager.NothingTrigger,
coin.position,
'y',
10,
200 // 200 ms
)
);