简体   繁体   English

如何在 PixiJS 中通过全局坐标缩放图形 object?

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

I have a PIXI.Container object that I need to scale straight up-and-down, by the Y axis of the camera.我有一个PIXI.Container object,我需要通过相机的 Y 轴直接上下缩放。 The object itself is rotated, so I don't want to scale by local co-ordinates. object 本身是旋转的,所以我不想按局部坐标缩放。

This will scale the object by local co-ordinates:这将按本地坐标缩放 object:

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.我假设我可以以某种方式使用container.worldTransform ,但我不明白如何使用它。

I ended up making two separate PIXI Containers: one for rotation, and an outer one for scaling.我最终制作了两个独立的 PIXI 容器:一个用于旋转,另一个用于缩放。 As suggested here: https://www.html5gamedevs.com/topic/46497-how-do-i-scale-a-graphics-object-by-global-coordinates-in-pixijs/?do=findComment&comment=255423正如这里所建议的: https://www.html5gamedevs.com/topic/46497-how-do-i-scale-a-graphics-object-by-global-coordinates-in-pixijs/?do=findComment&comment=255423

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM