GetCenterPointOfArea(object)

Approximates the central location of an area.

location GetCenterPointOfArea(
    object oArea
);

Parameters

oArea

Area to get center point of


Description

Get the (roughly) center point of an area.
This works by going through all the objects in an area and getting their positions, so it is resource-intensive.



Remarks

Not a function anybody would want to use, except perhaps for some debugging / testing. If you really need the central location of an area, I suggest you just create it yourself based on the size of the area. Assuming you store the size of all areas in two local floats on each area, called x and y, you can use the function I've written below instead.


Version

1.61

Example

//Resource light version of this function. Requires the size
//of the area to be stored as local floats on the area called x and y
location GetCentralLocation(object oArea)
{
float fX=GetLocalFloat(oArea, "x");
float fY=GetLocalFloat(oArea, "y");

vector vCenter=Vector(fX/2.0, fY/2.0, 0.0);

return Location(oArea, vCenter, 0.0);
}

See Also

categories: Area Functions | Debug Functions


 author: Lilac Soul