Jump to content

Pixi Viewport - Follow


KBSnyders
 Share

Recommended Posts

With the Pixi Viewport library - it makes it really easy to set up a "camera" in a way. 
It's all cool - but I've noticed something - when you follow a sprite, it'll follow it just fine going in one directPlion, and the camera will ease nicely after tweaking the options. 

But then, when I want the sprite to go in the opposite direction - it needs it to get right up on the edge almost before it moves. Anyone have any clue how to make this better? 

Played with these - https://davidfig.github.io/pixi-viewport/jsdoc/Viewport.html#follow

Link to comment
Share on other sites

  • 1 year later...

I had the same problem, I figured out that the problem was that the ticker was not the same like the app uses. (The default from pixi-viewport is Pixi.Ticker.shared)

So the answer was to set the ticker with the right one:

const viewport = new Viewport({
  worldWidth: 50000,
  worldHeight: 50000,
  screenHeight: 720,
  screenWidth: 1280,
  ticker: app.ticker,
});

 

Edited by Galious
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.

Guest
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.

Loading...
 Share

  • Recently Browsing   0 members

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