How to make the enemy stick to the ground when it was squashed?

My 2D sprite enemy can be squashed when my character stepped on it.But the result looked like it was floating .How can I fix that?
Here is a picture to illustrate the situation

Add a scene component to the base of your sprite enemy, make sure it is the parent of the sprite. So the hierarchy in the viewport of your actor should be like the first image. Then hook up the “scene” component to the “set world scale 3D” and it should scale so the scene is still touching the ground.

It didn’t work for me ,nothing happened :expressionless:

232679-screenshot-2.png

It worked for me in a blank project. But that may be because I was using a cube instead of a 2D sprite. Can you try my setup using a 3D mesh? Also, just another thought, I’m not by a computer right now but along that same vein, maybe don’t use set scale 3D, see if there is a set scale 2D as sprites are 2D assets maybe it is not working properly for that reason. Also can you post some actual screenshots of your set up? There may be something else you are missing.

Wow,after several attempts ,it turned out your first solution really works ,thanks!

Haha! Nice…sometimes things just don’t work and after restarting the editor or whatever it works. Sometimes it is a little box ticked or unticked that makes all the difference. Either way, glad you got it working! Good luck with the game.