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

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

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

[ad_1]

I rotate a node (with a inexperienced picture sprite for straightforward viewing) containing little one nodes (referred to as Dot, with purple coloration, collider2D and rigidbody2D). I alter the Rotation property and all Dots additionally change. I need to achieve this in code, nonetheless 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();

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

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

You can strive altering the kind to Animated.

[ad_2]

LEAVE A REPLY

Please enter your comment!
Please enter your name here