Any way to align an entity to all axises in minecraft bedrock?

I am trying to summon an object and then center it in Minecraft Bedrock Edition. I am trying to just make the coordinate the exact position (eg. 10.0 80.0 10.0 or teleporting to 10 80 10). I have tried to use a function to teleport it by 0.01 until it detects a new block, then teleports to it's centered coordinate, it works sometimes, but it also sometimes doesn't go to the correct cord, or goes on forever teleporting away. I do not have an exact cord that I am teleporting it to so that would not help.


Solution 1:

There are two ways you could do this. The first is to just summon the entity at the correct place, as everyone else has been telling you (I will use a sheep for the remainder of this)

/summon sheep 23 24 25

instead of

/summon sheep ~ ~ ~

The other way you could do it is to take advantage of a shulker's auto-align feature. You can summon a shulker, it will align automatically to the axis'. You can then execute as the shulker, and summon a sheep at it. Example:

/execute @e[type=shulker,c=1] ~ ~ ~ summon sheep

After this, you just kill the shulker.