Ok, I’ve gotten a lot of good information out of some books on JavaScript from the library, which lead to a better understanding of parameters, the stuff that goes in those parentheses. However, what I came across was not quite enough to fully explain this excerpt from the Unity scripting reference:
"Usage
bool Raycast (Vector3 origin, Vector3 direction, out RaycastHit hitInfo, float distance = Mathf.Infinity, int layerMask = kDefaultRaycastLayers)
Description
Casts a ray against all colliders in the scene.
The ray starts at origin and is directed along direction. The length of the ray is distance. Returns true if the ray hits any collider. If true is returned, hitInfo will contain more information about where the collider was hit (See Also: RaycastHit).
function Update () {
var hit : RaycastHit;
if (Physics.Raycast (transform.position, Vector3.down, hit)) {
distanceToGround = hit.distance;
}
}
// Raycast up to 100 meters forward
function Update () {
var hit : RaycastHit;
if (Physics.Raycast (transform.position, Vector3.down, hit, 100.0)) {
distanceToGround = hit.distance;
}
}
"
I don’t get what the word “out” is all about here. Any help?
Another term I saw in the scripting reference is “Enumerations”. I learned the meaning of several other terms, like Classes, Objects, Methods, and Arrays, but not Enumerations. I looked it up on the boards, and what NCarter said made some sense to me, but I don’t immediately see how to apply that to the material in the Enumerations section of the reference. If anyone can add to what he posted, I would much appreciate the help.
http://forum.unity3d.com/viewtopic.php?t=4014&highlight=enumeration
Thanks so much! 