HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

GetWidgetCollisionSize not working :(

10-28-2009, 11:14 PM#1
Komaqtion
Hi!

I was looking around here at wc3c.net and I saw Vexorian's GetUnitCollisionSize system.
Then I thought, is there a way to get something else's collision size, like a destructable or so :S

Well, since the whole concept of Vexorian's system won't work for this (I'd believe :S) I tried a different approach, and here's what I got:

Collapse JASS:
library GWCS initializer Init

    globals
        private constant integer CC_ID = 'z001'
        
        private unit COLLISION_CHECK
    endglobals

    function GetWidgetCollisionSize takes widget w returns real
        local real wx = GetWidgetX( w )
        local real wy = GetWidgetY( w )
        
        local real dx = wx
        
        loop
            set dx = dx + 1
            
            call SetUnitPosition( COLLISION_CHECK, dx, wy )
            
            exitwhen dx <= GetUnitX( COLLISION_CHECK )
        endloop
        
        debug call DisplayTextToPlayer( Player( 0 ), 0., 0., R2S( dx - wx ) )
        
        return dx - wx
    endfunction

            
    private function Init takes nothing returns nothing
        set COLLISION_CHECK = CreateUnit( Player( 15 ), CC_ID, 0, 0, bj_UNIT_FACING )
    endfunction
    
endlibrary

But, this doesn't work at all ! :(

When I test this with a unit which has 32 collision size (Object Editor value ;)) I get the value "14.000" from that debug message, and I also get the same value if I set the collision size to e.g 35...

Butm if I put 31 there instead, I get "1.000" ?!
What is wrong, and why am I getting these wierd value ? :o
10-28-2009, 11:27 PM#2
Vexorian
I think that option only affects when a destructable can be affected by AOE spells.

I also think that pathing is a different problem and depends on textures?
10-28-2009, 11:30 PM#3
Komaqtion
Quote:
think that option only affects when a destructable can be affected by AOE spells.

What do you mean ? :S

Quote:
I also think that pathing is a different problem and depends on textures?

Well, yeah but collision size also has something to do with it, right ? :S
10-29-2009, 12:15 AM#4
Anitarf
Quote:
Originally Posted by Komaqtion
What do you mean ? :S
A widget will be affected by an AoE spell as long as the widget's collision size intersects the spell area of effect.

Quote:
Well, yeah but collision size also has something to do with it, right ? :S
Apparently not.
10-29-2009, 07:23 AM#5
Komaqtion
So, are you saying there is no way of getting a widget's collision size ? :S
10-29-2009, 10:29 AM#6
Anitarf
You could probably try with an AoE widget-affecting damage spell...
10-30-2009, 12:48 PM#7
Deaod
Destructables (trees) can only be placed on a 64x64 grid (like buildings). Anything in between gets rounded to next number divisable without remainder by 64.

My guess is that Blizzard did this to optimize the pathing algorithm for static objects (that wont move).

I dont know about items but i dont think they have pathing (never seen it).
10-30-2009, 02:07 PM#8
grim001
Quote:
Originally Posted by Komaqtion
So, are you saying there is no way of getting a widget's collision size ? :S

Manually building a table of the ones you need is probably the most practical way to do it.
10-30-2009, 08:33 PM#9
Komaqtion
Quote:
Manually building a table of the ones you need is probably the most practical way to do it.

Well, yeah that is kinda what Viikuna said over at thehelper.net too...

Though he suggested I tried (Or requested) some kind of tool which would do this for you :D

Any1 know of such a tool ? :S