Reflect bullets in 3D world space

I want bullet to bounce/reflect mirroring the position they hit. I have it working… kind of. All collision faces facing a particular direction bounce the bullets off close enough to look correct. But any other facing direction of the colliders bounces incorrectly.

if (reflect)
            {
                RaycastHit hit;

                if (Physics.Raycast(this.transform.position, Vector3.forward, out hit, 10f))
                {
                    Vector3 incomingV = hit.normal - transform.position;
                    Vector3 reflectV = Vector3.Reflect(incomingV, hit.normal);
                    //Debug.DrawRay(hit.point, reflectV, Color.green, 10f);

                    Transform hitBounce = PoolManager.Pools["AMMO"].Spawn("BoltReflected");
                    hitBounce.position = hit.point;
                    hitBounce.eulerAngles = reflectV;
                }

                
            }

I have tried a few variations but it just doesn’t seem to ever work cleanly. Could someone please point out to me what I’ve gotten wrong?

It is working for a specific direction only because you are using Vector3.forward in your raycast hit, which will always be the same direction i.e. (0, 0, 1). What you want is the forward direction of your bullet, for which you need to use Transform.forward.

Just change your line of RaycastHit to use forward of your bullet’s transform as below:

 if (Physics.Raycast(this.transform.position, this.transform.forward, out hit, 10f))