|
So I'm trying to detect things within x radius and without y radius. A donut shaped area of detection. My plan is to use two OverlapSpheres and remove colliders from the small one from the collection the large one returns. Is this the best way to do this? If it is, what's the best way to filter an array like that? There don't seem to be any helper functions like Array.Without.
(comments are locked)
|
|
Well that's quite simple:
EDIT
Well, the Name is not really good but it's just a sample ;) I'm writing in javascript though. JS doesn't have a List collection.
Feb 25 '11 at 02:22 AM
Patyrn
What? who said that? If you would talk about JScript you might know from websites you're right, but UnityScript is a totally different language. It compiles also on the mono platform like C#. The greatest differences between C# and UnityScript is the syntax. JScript also don't support inheritance (it use prototypes) but in Unity it does. In the end you can do quite everything in both languages but in JS it's often the longer way and not as "save" as C#.
Feb 25 '11 at 05:25 AM
Bunny83
Is this not a spherical shell instead of a donut shape?
Feb 25 '11 at 07:32 AM
Herman Tulleken
Sure :D but he described it as donut. If you really want some kind of a donut shape (only a kind of) just use this function from a OnTriggerEnter Event of a box collider that specifies the "cut-out" area. If you just need it global axis-aligned flat on the floor you can check the relative y from the center and exclude all that lays outside. As I said it's just a volume that have the general form of a donut but it isn't
Feb 25 '11 at 10:56 AM
Bunny83
@Patyrn you could have your C# file separated and still use that function within your JS code: http://answers.unity3d.com/questions/21676/is-it-possible-for-c-script-using-class-written-in-js
Feb 28 '11 at 03:59 PM
Cawas
(comments are locked)
|

just a hint (maybe)... instead of calling it "x radius" and "y radius" it could be better to call 'em "
aradius" and "bradius". small detail, but I think it generates lot less confusion while reading because x and y look like axis coordinates.Probably a good idea.