Monday, August 22, 2022
HomeGame DevelopmentAltering scale utilizing tween disables the contact occasion in Cocos creator 3.5.0?...

Altering scale utilizing tween disables the contact occasion in Cocos creator 3.5.0? – Cocos Creator


Hello all, I’m utilizing Cocos creator 3.5.0. I’m attempting to make flip animation for which I’m altering the size utilizing tween. After I use tween within the callback perform of contact occasion and attempt to change the size of a node, contact occasion is disabled after tween execution. For instance,

 begin() {

     this.node.on(Node.EventType.TOUCH_START, this.func, this);
 }

func() {

    tween(this.node)
    .to(2, {scale : new Vec3(this.node.scale.x + 1, 1, 0)})
    .begin();

}

In line with this, node scale ought to improve by 1 for each contact, however after the primary contact and tween is executed. The contact occasion is disabled (or could also be destroyed). I don’t know if it’s the problem within the editor or am I lacking one thing ?


A workaround would most likely be to scale an middleman youngster of the node that deal with the contact occasion and never the occasion node itself.
And possibly change the ui remodel content material dimension of the contact node if you’d like it to correspond to the scaled youngster.

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments