Camera.screenView is never adjusted?

Recommended Posts

I just tried to use the Sprite.inCamera property and found that in my game it is always true, even when it shouldn't be.

After poking around in the phaser source for a bit I noticed that the Camera.screenView rectangle that it depends on is set once in the Camera constructor, then (apparently) never changed again.

Surely this should update every time the camera moves?  Or am I missing something obvious (again!)?


If I'm right and this will always be true, it will have some serious implications for Phaser performance as almost all culling type operations depend on it.  And if I'm wrong, then I'd quite like to know what I'm missing because I want my audio effects to skip when the breaking window is off-screen!

    // create function for flames coming out of a breaking window    create: function(o, x, y, speed)    {        this.owner = o;        this.sprite = Game.behindLayer.create(x, y, 'fire');        this.sprite.anchor.setTo(0.5, 1);        this.sprite.animations.add('burn');'burn', 10, true, false);        if (MissionControl.sfxWindowExplode && this.sprite.inCamera)  ;    },

Share this post

Link to post
Share on other sites

Because Pixi Sprite.getBounds used to return a local bounds, not in world space. I will fix that, but even if I do it still won't work because Pixi no longer takes the renderable property into account! It's just ignored now (see here) - so I'll need to submit a PR for that too.


Now you can see why I asked you to work on what you're working on next ;)

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.