Object destruction in zero gravity game (space shooter)

Hi there,
can somebody help me out here? I’m working on a smal space shooter, and I want to be able to destroy Asteriods when hitting them with the laser. I have a very basic skript to swap the objects and that work fine. The only problem is that the destroyedVersion needs a Rigidbody and it falling down now. Of course I’ve unchecked “Use Gravity”, but it still falls out of my gameworld. Any ideas?

Just assign the hit asteroid to a hitAstroid GameObject variable. You can call Destroy(hitAstroid); when you want to destroy the asteroid.

Hope this works as you want it to.

asteriodHit = GameObject.FindWithTag(“Asteroid”);
Instantiate(destroyedVersion, transform.position, transform.rotation);
Destroy(asteriodHit);

Still it adds gravity, and the “destroyedVersion” falls down. Is there any other way around it? Or am I doing something wrong?

I’m not sure why you want to swap objects rather than just destroying them in the code for on trigger enter but that being said, consider going to the rigidbody constraints for the asteroids and freeze the y position.