Raycast Coordinates

How would I go about raycasting to see if a certain point in space is unoccupied. Say I wanted to see if there was anything at 1,2,0 without getting the raycast result from a wall or object behind it. How would I do this?

Check out:

static function OverlapSphere (position : Vector3, radius : float, layerMask : int = kAllLayers) : Collider[ ].

This assumes that the objects that could possibly already occupy your space has colliders attached to them.

Sweet that works great

An only slightly related follow up:
What does the word kAllLayers mean in OverlapSphere’s definition? I cannot find another reference to this word in any searches, other than it’s use in the same definition. I assume the layerMask:int means I could also pass an integer that restricts the returned array by layers? maybe?

[Sigh] everything is so cryptic to a newb…

That’s telling you that the layerMask parameter has a default value (the value that will be used if you don’t supply one when you call the function); and that the default is equal to the value of kAllLayers.

kAllLayers seems to be undocumented (as you discovered) but is presumably a constant, defined by the Physics class, that means ‘include all layers’.

Yes, by passing an appropriate integer value, you can request only those results that belong to a particular layer or layers – see the LayerMask documentation for an easy way to work with layer masks.

I’ve been neck deep in C# and JS tutorials lately, scrambling to get control of this sweet environment. A terminology question: I understood the term “overloaded” to mean pretty much what you just described. Correct?

I love how messages get flooded to back pages so quickly. Awesome community here. And thanx!

An ‘overloaded’ method is one that has multiple definitions – i.e. can be called with different sets of arguments. The method you were asking about is indeed overloaded.