Weird results when using Vector3.Reflect and RaycastHit.normal?

I’m having a problem where my sphere sometimes just goes through an object, bounces back as if the velocity was inverted, and sometimes also reflects it, but mirrored?

Not sure how I should explain, so here’s a -video-.


My code for the reflecting and stuff is here :

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Bullet : MonoBehaviour
{
    private Rigidbody m_bulletRigidbody;
    private RaycastHit m_rayHit;
    private bool m_raycastDidHit;

    private void Start()
    {
        m_bulletRigidbody = GetComponent<Rigidbody>();
    }

    private void Update()
    {
        Debug.DrawRay(transform.position, m_bulletRigidbody.velocity.normalized, Color.red);
        m_raycastDidHit = Physics.Raycast(transform.position, m_bulletRigidbody.velocity.normalized, out m_rayHit);
    }

    private void OnTriggerEnter(Collider other)
    {
        if (m_raycastDidHit)
        {
            if (other.gameObject.tag != "Player" && other.gameObject.tag != "LocalPlayer" && other.gameObject.tag != "Bullet")
            {
                if (m_rayHit.transform.gameObject.tag != "Bullet" && m_rayHit.transform.gameObject.tag != "LocalPlayer" && m_rayHit.transform.gameObject.tag != "Player")
                {
                    Vector3 reflected = Vector3.Reflect(m_bulletRigidbody.velocity.normalized, m_rayHit.normal);
                    reflected.x *= m_bulletRigidbody.velocity.x;
                    reflected.y *= m_bulletRigidbody.velocity.y;
                    reflected.z *= m_bulletRigidbody.velocity.z;
                    m_bulletRigidbody.velocity = reflected; 
                }
            }
        }
    }

}

Anyone who can explain why this is happening? :o

I’m guessing this is moving fairly quickly considering it’s a bullet and if that’s the case then the physics loop to check for collisions may be missing some things. One thing you can do is keep track of the last position each frame and shoot a raycast from the last position to the new position to handle collisions that way instead of relying on the physics engine.

If you need to clarification just let me know.