Tuesday, October 25, 2022
HomeGame DevelopmentChange rotation mother or father however childrent not transfer - Cocos Creator

Change rotation mother or father however childrent not transfer – Cocos Creator


I rotate a node (with a inexperienced picture sprite for straightforward viewing) containing little one nodes (known as Dot, with purple shade, collider2D and rigidbody2D). I modify the Rotation property and all Dots additionally change. I wish to achieve this in code, nevertheless solely the blue half rotates.

I rotated each methods:

    tween(new Vec3(0, 0, 0))
      .to(3, new Vec3(0, 0, 360), {
        easing: "cubicIn",
        onUpdate(goal?: any) {
          wheelDot.eulerAngles = goal;
        },
      })
      .begin();

and

   tween(this.wheelDot)
      .to(
        3,
        {
          angle: this.wheelDot.angle + 360,
        },
        {
          easing: "cubicIn",
        }
      )
      .begin();

Each of the above codes simply rotate the inexperienced half and the purple dots keep in place.

edit: I came upon if I dropped RigidBody2D, the purple dots moved. How can I nonetheless use RigidBody2D and nonetheless rotate?


You’ll be able to attempt altering the sort to Animated.

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments