I’m playing around with the space shooter tutorial game provided in unity. I’m trying to make it so when I destroy an asteroid, it breaks up into two asteroids. I basically got that down, but when the asteroids are replaced with smaller asteroids, they fly off the game and through the background. (There are screenshots in the thumbnails). Is there any way to keep the asteroid remains in the same alignment as everything else so the player can shoot them?
Simple solution is to freeze the axis that you don’t want it to be able to move along- you can do this in the Rigidbody by setting the “constraints” flag to FreezePositionZ, I think (or X, if it’s turned around the other way). If you’re using a prefab for the smaller asteroids, you can do this is in the Rigidbody component in the inspector for the prefab, to save from having to do it each time the object is instantiated.