Hello,
I have 1 problem with raycast.
Code:
#pragma strict
var dot : Transform;
var defDotPos : Vector3 = Vector3(0, 1000, 0);
function Update()
{
var ray = transform.TransformDirection(Vector3.forward);
var hit : RaycastHit;
if (Physics.Raycast(transform.position , ray , hit, 150))
{
dot.position = hit.point;
}
else
{
dot.position = defDotPos;
}
}
This script is supposed to show a point(sphere) on the object which is in front of the character, but actually it loops sphere between character and that object. here is picture so you can see Screenshot by Lightshot
Its sidescroller im talking about.