I need to Instantiate an explosion in RayCastHit2D…how do I do it in the Instantiate function at the hit point of the ray?
I would have a prefab, explosion. Then, once you have the hit point, instantiate the prefab, explosion there at that position. The prefab explosion should have its own script that runs the explosion on Start().
I know that…I need to know how to use a hit.point or a hit.normal for RaycastHit2D…what do I put in this line
Instantiate(explode, where did ray hit and whatever else I need in here)
hit.point, transfrom.rotation
Of course you can then set the rotation in Awake or Start in the explosion script if that rotation is incorrect.
I had it right except for the transform.rotation…I was using hit,rotation…Thanks for the help
1 Like