Scaling problems (DEF-2386)

I’ve encountered a couple of strange things when working with non-uniform scaling of the top parent game object. (The purpose is to retain proper object proportions for all screen formats.)

If I create a “normal” game object, with sprite graphics, like this, everything is fine.

local ship = factory.create("#ship_factory",pos)
msg.post(ship, "set_parent", { parent_id = go.get_id() })

The game object inherits the scale of its parent. But if I create a game object containing a particle effect, that effect does not get properly scaled. It appears to retain its default world scale.

Second, if I want to create a game object with an initial rotation, for example like this,

local ship = factory.create("#ship_factory", pos, vmath.quat_rotation_z(angle))
msg.post(ship, "set_parent", { parent_id = go.get_id() })

and the angle is not zero, this messes up the scaling of the game object. It is as if the rotation is applied in a different coordinate system than that of the parent. But if I instead perform a rotation animation on the game object after it has been created, everything works fine.

How do you set the scale? If I set the scale on the parent object in the properties window in the editor it doesn’t scale the particle effect, but if I use go.animate() or go.set_scale() it seems to be working.

I use go.set_scale() on the parent object.

The game object starts up its particle effect by calling particlefx.play("#particlefx") in its script init method. Is this against recommended practice?

Nope, that should be perfectly fine, and I believe that was what @sven tested as well? In any case, we’ve opened a ticket for this issue: DEF-2386

1 Like

I bumped in this when I was scaling gameobject. If you do non uniform scaling like vmtah.vector3(2,2,1), only sprite will be scaled. Collision objects and ParticleFx will remain unscaled.

1 Like