Tuesday, August 23, 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 making an attempt to make flip animation for which I’m altering the size utilizing tween. Once I use tween within the callback operate 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 accordance with this, node scale ought to enhance 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 perhaps change the ui rework content material dimension of the contact node if you’d like it to correspond to the scaled youngster.

@Uldraxiel Thanks a lot to your suggestion :blush:, however I bought reply to my query.

Ans : As an alternative of utilizing ‘.to( )’ use ‘.by( )’ for scale modification utilizing tween.

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments