- Home /
Question by
ShinyTaco · Feb 28, 2013 at 04:18 PM ·
javascriptraycastsyntax
How to Less Than or Equal to with a Raycast?
Hey everybody,
How do you code from <= 300 on down to 0 in the following?
if (Physics.Raycast (transform.position, down, 300)) {
//DoSomething
}
Thank you.
Comment
Best Answer
Answer by Owen-Reynolds · Feb 28, 2013 at 04:42 PM
Do you mean, you want a list of everything out to 300, sorted from furthest to closest?
If so, RaycastAll will give you the list, in no special order (I seem to recall it tends to be sorted 1st to last, but the docs say it isn't.)
You can use any standard way to sort that list yourself (not a Unity thing, but maybe someone has a good javascript sort here.)
Thanks for your help. $$anonymous$$y question was worded poorly.