So i am trying to translate all my JS scripts to C# by using a converter and I understand that I will need to change a few errors that come up. In this most recent script, I am unsure of naming one of the variables I used in JS called “hit” Here is the code. I am having trouble because I don’t think its supposed to be RaycastHit.
JS function with hit. This is the only time hit is used
function Update()
{
var hit : RaycastHit;
var fwd = transform.TransformDirection(Vector3.forward);
if(Physics.Raycast(transform.position, fwd, hit, rayLength))
{
C# attempt. I assume RaycastHit is not a variable type or I named it incorrectly.
void Update (){
RaycastHit hit;
fwd = transform.TransformDirection(Vector3.forward);
if(Physics.Raycast(transform.position, fwd, hit, rayLength))
{