Sign in to follow this  
Zeto

Question about containers relative positions

Recommended Posts

I know the devs of pixi.js browse this this forum, so just want to say thank you so much for pixi.js! It is an absolutely wonderful framework. 

I have a simple question and haven't been able to find the answer online. Containers have a width/height which is the total width and height of the sprites in the container, I think. Is there a minX/minY value for the sprites in the container, relative to the position of the container? For example, a container is set to position (20,20). Two sprites inside the container are set to (-10,-10,30,30) as (relX, relY, width, height), and  (0,0,40,40). I believe that container.width will be 50, container.height will be 50. Is there a way to find the minX/minY relative to the container (-10,-10)? In other words, I would like to find the bounding rect of the sprites in a container relative to the container itself.

Share this post


Link to post
Share on other sites

Thank you! getLocalBounds was the function I was looking for. @ivan.popelyshev I don't quite understand your warning, but for the purpose of a simple sprite engine with no transformations whatsoever besides a simple horizontal scale = -1, it has been working well for me! Thank you xerver for the answer too! Cheers

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
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.