Boo script Physics.Raycast error?

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?

I'm going to assume it's the syntax. That is the C# syntax for raycast. Not sure what it is for Boo.

From Unity Referance: import UnityEngine import System.Collections public class Example(MonoBehaviour): def Update() as void: hit as RaycastHit if Physics.Raycast(transform.position, -Vector3.up, , 100.0F): distanceToGround as float = hit.distance As you can see it has the double commas instead of "out hit" like in c#

2 Answers

2

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?

From Unity Referance: import UnityEngine import System.Collections public class Example(MonoBehaviour): def Update() as void: hit as RaycastHit if Physics.Raycast(transform.position, -Vector3.up, , 100.0F): distanceToGround as float = hit.distance As you can see it has the double commas instead of "out hit" like in c#

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

I get: No appropriate version of 'UnityEngine.Physics.Raycast' for the argument list '(UnityEngine.Vector3, UnityEngine.Vector3, UnityEngine.Collider, single)' was found. From this. Anyone else?