Sign in to follow this  

How do I scale a graphics object by global coordinates in PixiJS?

Recommended Posts

I have a PIXI.Container object that I need to scale straight up-and-down, by the Y axis of the camera. The object itself is rotated, so I don't want to scale by local co-ordinates.

This will scale the object by local co-ordinates:

container.scale.y = scaleFactor;


How do I scale it by global coords by this scale factor? I'm assuming I can use `container.worldTransform` somehow, but I don't understand how to use this.

Share this post

Link to post
Share on other sites

transform affects only local coord matrix.

the resulting worldTransform is "parent.transform.worldTransform  * this.transform.localTransform". There's no way to do your thing in vanilla pixijs. However, you can hack the transform like i do here:

just set "transform.updateTransform = transformHack", where transformHack is your own update function based on

Alternatively, you can scale before rotation is applied by combining two containers: one for scale outside, one for rotation inside.

Share this post

Link to post
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.

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.

Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.