Flip 2d game object vertically

I want to flip my whole game object vertically. My go constist of one simple sprite (just one image, no animations) and a collision object.

Flipping just the sprite is not sufficient, because I also need to flip the collision object.

I tried rotating the go around x axis for Pi radians:

go.set_rotation(vmath.quat_rotation_x(math.pi))

which flips the object, but just shows half of the sprite. THe other half is not shown.

I also tried to simulate this rotation using

local x1 = vmath.vector3(1, 0, 0)
local y1 = vmath.vector3(0, -1, 0)
local z1 = vmath.vector3(0,0,1)
go.set_rotation(vmath.quat_basis(x1, y1, z1))

but it has no effect.
Any help will be appriciated!

The solution that i found, and works, is flipping the sprite and the collision object.

		sprite.set_vflip("#sprite", true)
		physics.set_vflip("#collision_obj", true)

I consider this as a artial solution. It seems to work in my small example, but will prove impractical when dealing with complex game objects.

1 Like

This might also work?

go.set(".", "scale.y", -1)