Click button to control animation playback

var Carhost = pc.createScript('carhost');

Carhost.attributes.add("rightDoorEntity", { type: "entity", title: "RightDoorEntity" });

// initialize code called once per entity

Carhost.prototype.initialize = function() {

var app =;

    app.on('carOpenDoor', this.carOpenDoor, this);


// update code called every frame

Carhost.prototype.update = function(dt) {



Carhost.prototype.carOpenDoor = function (index) {



    this.rightDoorEntity.anim.setBoolean('IsOpenrun', !this.rightDoorEntity.anim.getBoolean('IsOpenrun'));


The first click of the button can trigger the animation, and the second click has no effect

Hi @guohao, I’m afraid this is an English speaking forum. Can you please edit your post for English?

Hi @guohao and welcome! Can I see a screenshot of the transition between open and close please?

Entity.anim. SetBoolean has no effect

Can you check the result if you set the Exit Time of the transition to 0?

Can you also share a link of your project please, so I can check this problem by myself?

I’m sorry to reply to you now. I tried to use your scheme and found that the effect was achieved. It’s amazing. Thank you very much

1 Like