engine icon indicating copy to clipboard operation
engine copied to clipboard

How to properly invert sprite (set negative scale)

Open drgomesp opened this issue 4 years ago • 1 comments

I'm trying to invert a sprite by setting its scale to negative (x axis) and then simply removing and adding it to the scene again, but the sprite never gets flipped. Is there any recommended way of doing that? This is what I'm currently trying:

sprite.SetScale(-1, 1, 0)

drgomesp avatar Mar 30 '21 22:03 drgomesp

After https://github.com/g3n/engine/commit/abef212b4d1ba6896bc3dfa2db5eec73c11fe71f negative sprite scaling should work. Just make sure to use a back-sided or double-sided material e.g.:

yourSpriteMaterial.SetSide(material.SideDouble)

danaugrs avatar Jul 23 '21 15:07 danaugrs