Wintermute Engine Forum

Wintermute Engine => Technical forum => Topic started by: serdar on September 01, 2010, 02:32:31 PM

Title: Dynamically Create Region
Post by: serdar on September 01, 2010, 02:32:31 PM
hi,

I have asked a question before about this topic on forum.
http://forum.dead-code.org/index.php?topic=4426

but i have a different problem now. I created the regions dynamically but some places in my region are not catching mouse...

Am I setting wrong points...
(http://www.serdarb.com/regionpoints.png)

You can download sample project here
serdarb.com/RegionProblem.zip (http://serdarb.com/RegionProblem.zip)
Title: Re: Dynamically Create Region
Post by: Mnemonic on September 01, 2010, 02:49:26 PM
The order of the points matters. This way you created kind of twisted regions, not rectangles (try painting the points on paper and connect them with lines).

This should work as expected (notice the points are added in clockwise order):

Code: WME Script
  1. zLeftRegion.AddPoint(0, 0);
  2. zLeftRegion.AddPoint(170,0);
  3. zLeftRegion.AddPoint(170, Scene.Height);
  4. zLeftRegion.AddPoint(0, Scene.Height);
  5.  


Code: WME Script
  1. zRightRegion.AddPoint(1100, 0);
  2. zRightRegion.AddPoint(1280,0);
  3. zRightRegion.AddPoint(1280, Scene.Height);
  4. zRightRegion.AddPoint(1100, Scene.Height);
  5.