Hey Community, I've got a problem in Java Script: If I write this Code:
function FindTarget(){
var hit : RaycastHit;
var ray : Ray;
ray.origin = transform.position;
ray.direction = target.position - transform.position;
canAttack = false;
var relPosition : Vector3 = target.position - transform.position;
if(Physics.Raycast(ray, hit , relPosition))
{
if(hit.collider.gameObject.transform == target)
{
canAttack = true;
}
}
I'll get this error:
Mono: Assembly Loader loaded assembly from location: 'C:\Program FilAssets/Scripts/Enemy.js(68,19): BCE0023: No appropriate version of 'UnityEngine.Physics.Raycast' for the argument list '(UnityEngine.Ray, UnityEngine.RaycastHit, UnityEngine.Vector3)' was found.
Is it because of the out parameter of the variable "hit" or because of MonoDevelop?
Thanks in advance, Sebastian