here my code review it
if found solve
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.AI;
public class Cyborgscrip : MonoBehaviour
{
// Start is called before the first frame update
public GameObject ject;
public float lengh;
public GameObject pos;
private NavMeshAgent navMeshAgent;
private Animator animator;
public Vector3[] side;
void Start()
{
animator = GetComponent<Animator>();
navMeshAgent = GetComponent<NavMeshAgent>();
side[0]=pos.transform.forward;
side[1]=pos.transform.right;
side[2]=-pos.transform.right;
}
// Update is called once per frame
void racas(Vector3 pps)
{
Ray ra =new Ray(pos.transform.position,pps);
RaycastHit hit;
if (Physics.Raycast(ra,out hit,lengh) )
{
if (hit.transform.GetComponent<move>() )
{
Debug.Log(hit.transform.name);
}
}
}
void Update()
{
for(int i =0; i< side.Length ;i++)
{
racas(side);
}
navMeshAgent.SetDestination(ject.transform.position);
animator.SetFloat("Blend",navMeshAgent.velocity.magnitude);
}
}