#Physics.Raycast hitting playerCollider when angled at anything above 25 on the x, can anyone help

1 messages · Page 1 of 1 (latest)

brave garden
#

i added the script to the fire script to the g*n object

#

and the raycast originates from the camera

#

Heres my code: ```using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class fireScript : MonoBehaviour
{
public float damage = 10f;

public Transform shootPos;

void Start()
{
    
}
void Update ()
{
    if(Input.GetButtonDown("Fire1"))
    {
        Shoot();
    }
}

public void Shoot()
{
    RaycastHit hit;
    if(Physics.Raycast(shootPos.transform.position, shootPos.transform.forward, out hit, 100f))
    {
        Debug.Log(hit.collider.tag);
        Debug.Log(hit.collider.name);
    }
}

}

#

i dont know whats wrong with it