Jump to content

Animation pivot points


Recommended Posts

Hi all

I've got an animation of a running ninja (original hey).  Sprite sheets attached.

I am doing the following in my code:

Preload function:

this.load.atlas('sprites', this.p('Sprites.png'), this.p('Sprites.json'));

Create function:

        this.ninja = this.physics.add.sprite(this.gameWidth/2, this.gameHeight/2, 'sprites', 'stand').setCollideWorldBounds(true);

        let runConfig = {
            key: 'run', 
            frames: this.anims.generateFrameNames('sprites', { 
                prefix: 'run', 
                start: 1, 
                end: 7, 
                zeroPad: 0 
            repeat: -1,
            frameRate: 5


I am using texturepacker (https://www.codeandweb.com/texturepacker) to create the sprite sheet as a Phaser3 spritesheet.

I have set the pivot points for each frame to be on the ninja's chin so that the head is always still when he is running.

When I run the game the character jolts left and right as if it is ignoring the pivot points that I've set in texture packer.

Is this a bug or am I missing something obvious please?

Thanks so much!



Link to comment
Share on other sites


  • Recently Browsing   0 members

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