Jump to content

Change pivot position of a group


moukthik
 Share

Recommended Posts

Hi I am new to phaser . I am working on a animation to rotate a glass with lid . when I rotate it ,it rotates anti cliockwise to the left . I want it turn clockwise to right  . and when I try to change the pivot position the group position gets changed. Need help . 

Link to comment
Share on other sites

function createGlass() {

                closedGlass = game.add.group();
                
                closedGlass.create(game.world.centerX+200,game.world.centerY+300, 'glass');
                closedGlass.create(game.world.centerX-75, game.world.centerY+80, 'glassLid');
                
                
                // closedGlass.pivot.x = 5;
                // closedGlass.pivot.y = 5;
                closedGlass.position.x = 100;
                closedGlass.position.y = 150;

                closedGlass.scale.set(scale,scale);
                
                game.physics.p2.enable([closedGlass], false);
                
                block.body.static = true;
                closedGlass.children[0].body.static = true;
                closedGlass.children[1].body.static = true;
                
                
            }

function playAnim(){
                    game.add.tween(closedGlass).to({
                        rotation: -1
                    }, 2000, Phaser.Easing.Linear.None, true);
                   
                   }

 

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...