Hi, in my game, I have enemies composed of a Gameobject with Sprites/Models as child. I want the Sprite/Model shake when the enemies are damaged, but I don’t have any idea how can I shake these object (X axis). I appreciate any advice you could give me.
I recommend keeping the original transform.position of your game object when the shaking begins. Then in each frame offset the transform position by a random amount using Random.InsideUnitCircle(). This will give you a random vector with a maximum magnitude of 1 which you can multiply by for greater shakiness.
One thing to watch for, if your GameObjects have RigidBodies or colliders, directly translating them may screw up your physics.
Same applies to 3D