Cannot read property '_getEffectiveTarget' of undefined in action.then

https://www.babylonjs-playground.com/#1T30HR#1

Trying to chain actions using .then(InterpolateValueAction) causes a “Cannot read property ‘_getEffectiveTarget’ of undefined” error.

Here is a working example https://www.babylonjs-playground.com/#1T30HR#4

Still looking into .then on actions but for now you can use it from the actionmanager.

The action needs to be registered before chaining

Thanks. I see the subtle difference.

I was doing:
registerAction(action1.then(action2));

You are doing:
registerAction(action1).then(action2);

So, it works, but in an unexpected way. I thought that the .then meant it was a sequence of actions. I expect the sphere to scale and then slowly scale back. In your example, it scales on a pick and scales back when you pick again.

What’s the proper way to create a sequence so that they happen in order on the first trigger?

Did you figure it out? I have same use case. I want to chain 2 InterpolateValueActions (although i need non existent WaitAction too ;). Here is my version of your PG. It just executes the action without trigger after some delay.

AS there is no trigger you cannot chain then but instead you can call them like this:
https://www.babylonjs-playground.com/#1T30HR#6

I want to avoid managing timers myself. Maybe i should use Animations? My use case is: after some event interpolate material diffuse color from blue to red, then wait some time and interpolate back to original color.

Ok understood! Then animation + onAnimationEnd callback is the way to go :wink: