davidfig / pixi-viewport

A highly configurable viewport/2D camera designed to work with pixi.js
https://davidfig.github.io/pixi-viewport/
MIT License
1.04k stars 174 forks source link

Follow nested objects malposition #448

Open mrtoorich opened 1 year ago

mrtoorich commented 1 year ago
const planet1 = new PIXI.Sprite()
const planet2 = new PIXI.Sprite()
const planet3 = new PIXI.Sprite()

planet1.anchor.set(0.5)
planet2.anchor.set(0.5)
planet3.anchor.set(0.5)
planet1.position.set(0, 0)
planet2.position.set(100, 100)
planet3.position.set(50, 50)

viewport.addChild(planet1)
planet1.addChild(planet2)
planet2.addChild(planet3)

When viewport.follow(planet3), it follows (50, 50) not (150, 150).