Example #1
0
    private void OnCollisionEnter(Collision collision)
    {
        if (collision.gameObject.tag == "WallArea")
        {
            Quaternion Qua = Quaternion.FromToRotation(Vector3.forward, collision.GetContact(0).normal);

            Vector3 hitLocation = new Vector3(
                collision.GetContact(0).point.x + (collision.GetContact(0).normal.x * 0.01f /*offset*/),
                collision.GetContact(0).point.y + (collision.GetContact(0).normal.y * 0.01f /*offset*/),
                collision.GetContact(0).point.z + (collision.GetContact(0).normal.z * 0.01f /*offset*/));

            decalSpawner.DrawDecal(hitLocation, Qua);
        }
    }