- Home /
Question by
Ian-McCleary · Apr 13, 2014 at 11:17 PM ·
javascriptraycast
The name 'Raycast' does not denote a valid type ('not found')
Ok, So i have a simple enough script for Mining in my game but for some reason this error pops up.
The name 'Raycast' does not denote a valid type ('not found') on 25,11
So here is my script and if you could please help me out with what i might have done wrong the would be great!
Error on 25,11
#pragma strict
var test : Transform;
var Character : Transform;
var maxhit : float = 1.5;
var RayCenter : Transform;
var attack : Animation;
var idle : Animation;
var Distance : float;
function Update ()
{
if(Input.GetButton("Fire1"))
{
animation.Play("attack");
}
if(Animation.isPlaying == false);
{
Animation.CossFade("idle");
}
}
function mine()
{
var hit : Raycast;
if(Physics.Raycast(RayCenter.transform.position, RayCenter.transform.TransformDirection(Vector3.forward),hit))
{
Distance = hit.distance;
if(Distance <= maxhit);
{
hit.transform.SendMessage("Mining",Character, SendMessageOptions.DontRequireReceiver);
}
}
}
Comment
Best Answer
Answer by Ian-McCleary · Apr 13, 2014 at 11:28 PM
I forgot to put Hit after raycast... hits himself in the head
Your answer
Follow this Question
Related Questions
Can someone help me fix my Javascript for Flickering Light? 6 Answers
Setting Scroll View Width GUILayout 1 Answer
Disabling a lineRender or Ray when there is no target 1 Answer
ray cast not working ? 2 Answers
Raycasting 1 Answer