g3n / engine

Go 3D Game Engine (http://g3n.rocks)
https://discord.gg/NfaeVr8zDg
BSD 2-Clause "Simplified" License
2.82k stars 298 forks source link

How to properly invert sprite (set negative scale) #230

Open drgomesp opened 3 years ago

drgomesp commented 3 years ago

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)
danaugrs commented 3 years ago

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)