Hello so i want to achive my raycast to follow the gameobject it hit so i can set my vector3 FollowTarget so the vector3 will be aways following the raycast that is following the gameobject that is moving private void
MoveSelectedToCursorPosition()
{
RaycastHit raycastHit;
Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
if (Physics.Raycast(ray, out raycastHit, 1000.0f))
{
if(raycastHit.collider.tag == "Terrain")
{
gameController.UnitSelection.MoveSelectionToPosition(raycastHit.point);
}
if(raycastHit.collider.tag == "Minion")
{
FollowTarget = raycastHit.point;
gameController.UnitSelection.MoveSelectionToPosition(FollowTarget);
}
}
}