Jump to content

Change pivot position of a group


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;

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

function playAnim(){
                        rotation: -1
                    }, 2000, Phaser.Easing.Linear.None, true);


Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

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