My animation activated through Lua is not looping (I found a solution)

I have an object with a spinning animation. Using this piece of json:

	"effect_list": {
		"default": "file(/data/rigs/entities/gizmos/float_bobber/effects/buoy.json)"

It worked ok and it kept spinning forever.

But I want it to spin only when I place it in the water. So I removed that from the json and in my Lua code where it detects the object in the water, I added this:

radiant.effects.run_effect(self._entity, “buoy”)

It works, but the animation only runs once. I want it to loop the animation. How can I do it?

(When in the ground, it should not move, while in water it should move)

I found how. I just needed to call set_cleanup_on_finish(false)
So my effect is now run using:

self.buoy_effect = radiant.effects.run_effect(self._entity, "buoy"):set_cleanup_on_finish(false)

1 Like