Hi, im trying to raycast towards local -y direction of a game object that rotates on its z axis, but it seems like im getting only the global values. heres the script:
function Update ()
{
var hit : RaycastHit;
if(flip_button.flip==1){ //if button is pressed
if (Physics.Raycast (transform.position, -Vector3.up, hit,100))
{
if (hit.collider.name == "walking_surface")
{
Debug.Log(hit.point.x);
Debug.Log(hit.point.y);
Debug.Log("HIT");
flip_button.flip = 0;
}
}
}
}
[16586-screen+shot+2013-10-16+at+12.20.00+pm.png|16586]
in the above image, the question mark thing is the “walking surface”, the clown is the game object from which raycast is to be done. the clown moves all over the surface of the “walking surface”. (in 2D)
please help