How to implement spam-click open/close of objects properly?

Hi,

I’m trying to implement animated open/close interaction with furniture Actors.

I wish to make it as much modular as possible. Also, I would like my interaction be spam-clicked, so player shouldn’t wait for animation finished.

Initially I’ve created component based on StaticMeshComponent which holds data isOpen.

I’m familiar with Timeline component, but this component cannot be used in StaticMeshComponent, unfortunately.

So, I ended up to have Child Actor Component, but I know it is a bit wrong approach, also it is a bit buggy.

There’s a video how it should behave: https://youtu.be/2z-LRg59hY0?t=50&feature=shared
Also, at the beginning I’m presenting how I implemented it.

Is there any better way to do that? I found that I cannot use only one Timeline, because it stores currently played time for, as an example, Drawer1, and when clicked on Drawer2 it animates at the same position as previous interacted one.

Thank you in advance!

You can create a helper actor from your StaticMeshComponent that will have the TimeLine and other necessary logic that cannot be placed in the component. But remember to remove it when it is no longer needed.

The last time I used it (it was a multiplayer, a few years ago) I promised myself NEVER to use it.
I have never seen such strange errors anywhere. It was terrible and cost a lot of time.

Thank you for confirming that Child Actor Component is buggy, I was afraid that I’m only one who see it like that :smiley:

That’s interesting approach, but I’m afraid won’t suit for me, since I want to have that animation for my Actor’s (i.e. BP_Chest) static meshes (i.e. SM_Drawer). Otherwise, it will be very hard to maintain, I think.

At this moment I’m sticking to use Timelines with Play from Start/Reverse from End entries, so interactions will be waiting for animation to finish.

If no better solution will be presented, I’ll publish my BP image with how I implemented it for future developers. Actually I will do it as soon as I reach my PC xD

I’m currently have it as much modular as I wanted, but without spam-click.

I created BP_OpenableActor, which is base for my BP_Chest. This one contains Timeline with default animation speed Alpha, which is taking .5 second from 0 to 1 value:

I have created extended StaticMeshComponent, which has this method AnimateMovement:

That’s basically it :smiley: