Jump to content

Removing animation


Recommended Posts

How to remove animation from an object?

First I don't want animation when the object spawns, but after some actions I want it to have animation.

Making the thing invisible will still use power to draw it anyway so its not good option.

Link to comment
Share on other sites

No objects have their animations removed, as far as I know.

 

I think what you are trying to get is something akin to the teleportato, where it has an idle_off animation that makes it do nothing, and after you insert the pieces, it updates and gets an animation that shows the parts moving.

 

You can also use inst.AnimState:Pause() to freeze the object's animation and Resume() to keep it going.

 

Or what you want is an invisible object that appears when performing a ritual without interacting with it, and you want to assign it an empty animation?

 

Well, you can always use Hide() and Show().

 

However, you don't need to if you want, for example:

local assets = {}local function fn()    local inst = CreateEntity()    inst.entity:AddTransform()    inst.entity:AddAnimState()    inst.entity:AddSoundEmitter()    inst.entity:AddNetwork()    MakeInventoryPhysics(inst)    inst.AnimState:SetBank("ashes")    inst.AnimState:SetBuild("ash")    inst.entity:SetPristine()    if not TheWorld.ismastersim then        return inst    end    inst:AddComponent("inspectable")		inst:DoTaskInTime(5, function()		inst.AnimState:PlayAnimation("idle")	end)    return instendreturn Prefab("common/test", fn, assets)

 

When you spawn this prefab, you won't see it, it will appear after 5 seconds.

I just don't initialize AnimState with an idle play animation.

 

So I'm guessing you will put a ListenForEvent there, to make those actions push an event.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
  • Create New...