HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

jass charge spell: how do I best detect tree/cliff collision?

07-31-2007, 04:22 PM#1
Lordy
I'm making a charge spell. I want the hero, while he is charging, to collide into any trees/cliffs he might charge into. I could detect collision if I could group all trees/cliff in the area surrounding the hero, but I don't know how to.
Another option to detect collision might be to SetUnitPosition(some_invisible_unit) at the location of the charging hero, and then if the new location of some_invisible_unit is not equal to the hero's location then that location is a bad one (tree,cliff,unit).
What's the right solution for my collision problem? =)
Thanks,
Remy.
07-31-2007, 04:26 PM#2
Naakaloh
native EnumDestructablesInRect (rect r, boolexpr filter, code actionFunc) returns nothing

Edit: As far as cliffs go; you can check the pathing of the terrain to see if impassible on land using native IsTerrainPathable (real x, real y, pathingtype t) returns boolean Just keep in mind that the return values for it are reversed from what you would expect. True means that the flag is set on that point that doesn't allow units to pass.
07-31-2007, 10:11 PM#3
midiway
Quote:
Originally Posted by Naakaloh
Just keep in mind that the return values for it are reversed from what you would expect. True means that the flag is set on that point that doesn't allow units to pass.


PUTA QUE PARIU < -- portuguese

So...
native SetTerrainPathable takes real x, real y, pathingtype t, boolean flag returns nothing
boolean flag from this native is inversed too?
07-31-2007, 11:49 PM#4
Naakaloh
If you do something like set isWater = IsTerrainPathable(x,y, PATHING_TYPE_FLOAT) it will return true land and false on water.

So, yes, I'm assuming that something similar applies, but I haven't tried it with SetTerrainPathable, so I can't confirm for sure.

Edit: I'm assuming from your exclamation that you were having an issue with this before?
08-01-2007, 01:14 AM#5
midiway
Yes, in my speel to the speel making session 9 I had a tree with no pathing set in the 'Object Editor'.

Then I wanted to make the tree unpathable, but SetTerrainPathable wasn't working.