HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Overlapping Rects

01-13-2007, 07:50 PM#1
Pyrogasm
When there are two rects overlapping or occupying the same space, if a unit enters where they overlap, does the unit "enter" both regions, or just one or the other?

Also, because it's a related question, Instantly moving a unit to a point inside a rect does not count as the unit "entering" the rect, correct?
01-13-2007, 07:57 PM#2
wyrmlord
1. I would think that it would count as a unit entering both rects, because it's inside both rects, right?

2. Moving a unit instantly into a rect triggers the "Unit Enters Rect" event I'm 95% sure.
01-13-2007, 08:06 PM#3
Pyrogasm
Really?
Quote:
Originally Posted by Anitarf
There's also no infinite loop involved. The unit will just, under special conditions, be moved to the center of the region when it enters it. Since it's already in the region by then, the event will not fire again when it's moved.
On this trigger in Illidan(evil)X's signature:
Region 000:
Collapse Events
Unit - A unit enters Region 000 <gen>
Collapse Conditions
Region 000 <gen> contains (Entering unit) equal to true
Collapse Actions
Unit - Move (Entering unit) instantly to (Center of Region 000 <gen>)

I understand it to mean that the trigger won't fire if the unit is moved by the above actions...
01-13-2007, 08:12 PM#4
wyrmlord
If a unit is already in a region and then is instantly moved into a point in the same region, I don't think that would could as "Entering the rect".
01-13-2007, 08:31 PM#5
Captain Griffen
There is no such thing as a unit enters rect event.

Region events do not interfer with each other - they are independant.

I don't think moving within a region will trigger the event. In fact, I'm 99% positive.
01-13-2007, 08:41 PM#6
Ammorth
Pyrogasm, that trigger wont work because "Unit enters region" fires right before the unit actually enters the region. That means your condition will always be false.

Someone wrote a system called "Super Rects" where you could create rects and determine which rect a unit entered, and other useful stuff.

The easy work around is to make a slightly larger region, and check to see if the unit is inside that region, when entering the smaller one.
01-13-2007, 08:45 PM#7
Captain Griffen
Or make a custom function that checks if it is just outside the region?
01-13-2007, 11:42 PM#8
Pyrogasm
Oh, that wasn't my trigger. I was quoting Anitarf and the trigger I posted above was the trigger that he was commenting on.
Quote:
Originally Posted by Captain Griffen
There is no such thing as a unit enters rect event.
WHAT???
Trigger:
Events
Unit - A unit enters Region 000 <gen>
Did I miss something?
01-13-2007, 11:54 PM#9
Anopob
Maybe because he meant there IS a thing as "a unit enters region event"? Lol.
01-13-2007, 11:55 PM#10
Pyrogasm
Aren't rects and regions equivalent? In GUI it's a region, and in JASS it's a rect.

I said "rect" because it's the correct term for them... isn't it?
01-14-2007, 12:53 AM#11
Vexorian
That's one reason to trash GUI.

Real definitions:

region : Group of points can trigger events when units leave/exit the group of points (this is actually related to collision size). It is easy to add/remove points from them and also rects

rect : An object that holds 4 reals, max x, max y , min x , min y, coordinates of 2 points that form a rectangle, these do not have any enter/leave event.

In fact, when you call that BJ function of the enter rect event it creates a region object, adds the rect to the region and registers the event for the newly created region.

This is the reason many people think that moving rects is "bugged" , btw if you actually "move the region" instead of the rect, the event works correctly and all..
01-14-2007, 02:29 AM#12
Pyrogasm
I stand corrected.