so I was making this script for the FPS I am making and I wanted to know what was going wrong because I got this error:
Assets/gun.cs(24,46): error CS1061: ‘Transform’ does not contain a definition for ‘postion’ and no accessible extension method ‘postion’ accepting a first argument of type ‘Transform’ could be found (are you missing a using directive or an assembly reference?)
here is the code:
using UnityEngine;
public class gun : MonoBehaviour
{
public float damage = 10f;
public float range = 100f;
public Camera fpscam;
// Update is called once per frame
void Update()
{
if (Input.GetButtonDown(“Fire1”))
{
Shoot();
}
}
void Shoot ()
{
RaycastHit hit;
if (Physics.Raycast(fpscam.transform.postion, fpscam.transform.forward, out hit, range))
{
Debug.Log(hit.transform.name);
}
}
}
my goal is to make a raycast gun script