Instantiate bullet Impact Effect on cube , rotation problem
hi . i have a shooting game . there is a box in my scene . when i click shot button , a ray cast fired from camera :
ray = new Ray(MainCamera.transform.position,MainCamera.transform.forward);
then Instantiate a bullet Impact effect on the hit position :
HitedCord=hit.point;
HitedGO = GameObject.Find(hit.transform.name);
var Cloned:GameObject = Instantiate(ImpactEffect,HitedCord,HitedGO.transform.rotation);
this code Instantiate Impact Effect on cube with cube rotation !
but i want Impact Effect face up if ray cast , hit top of the box or when ray cast hit , right side*strong text of box , i want Impact Effect rotate and face right* .
how can i do this ?
maybe this image help me explain better :
the arrows are bullet impact effect on box :-D
Comment