My script is as follow
import UnityEngine
class detection_script (MonoBehaviour):
def Start ():
pass
def FixedUpdate ():
pass
def OnTriggerStay(collisionInfo as Collider):
if collisionInfo.collider.tag == "Player":
origin = transform.parent.position
if (Physics.Raycast(origin, transform.parent.rotation, ,100)):
Debug.Log("Hit")
It gives the error:
Assets/detection_script.boo(14,68): BCE0043: Unexpected token: ,.
Any idea why?
You have two commas in line 14:
if (Physics.Raycast(origin, transform.parent.rotation, ,100)):
Are you missing an argument? or did you just hit comma twice?
It seems the Unity documentation has an incorrect example, you can’t simply leave out an argument to a function. According to this the out
keyword is replaced with ref
in boo and doesn’t have to be specified when calling the function, therefore your code should translate to something like this:
hit as RaycastHit
if Physics.Raycast(origin, direction, hit, 100):
print hit.distance