How do you make a type of excavation when a gameobject collides with another gameobject?

I am making a sort of space sim. In my game, you control a ship and I need to figure out how to make it so that you fire projectile rigidbody spheres at cube-like meshes (with rigidbodies?), that are “asteroids”. How can I make it so that when you shoot at one of these meshes, it has an indent at where you shot, and can eventually fully disappear when you have shot it enough. This should be somewhat like in space engineers.

well this is a bit more complex since youre actually asking several questions …

fire a sphere projectile

first create the sphere you want to shoot than save it as a prefab you can than spawn it with Object.Instantiate ( see Unity - Scripting API: Object.Instantiate)

so when you click you should execute that instantiate command of course include the position where you want it to spawn (in front of your blaster i guess ?) and assign the sphere prefab to it

you will then at first only have a sphere in front of your blaster i would suggest to use Force to let the sphere move (Unity - Scripting API: Rigidbody.AddForce)

also dont forget to turn off “Usergravity” since you are in space theres no gravity! it will fall down if you dont do that.

the sphere and your cube asteriod should both have rigidbodys with no gravity andn both should have colliders that match their appearance!

you should also assign a proper mass for example an asteroid may weight up to some tons! the mass field of the rigidbody component is the objects weight in kg also keep in mind if you let your blaster sphere only have a mass of 1 and the asteroid has 1000000 it wont affect the asteroid it should be something like 10 and 100 i think… (just a guess you will ahve to experiment with different values)

so now you have a blaster that gets shot and it may hit the asteroid and both will move properly afterwards the indent is kinda complex so i skip this for now

for it to dissapper you could assign hp to it and if it gets hit it will lose 1 hp each so if you hit it lets say 3 times it will be destroyed

the indent thing could be done with adding bones to your cube mesh and move each bones or something i dont know an easy way for that sorry

i hope i could help you a bit

best regards