mp_grid_clear_rectangle

Marks all cells that overlap the indicated rectangle as being free.

Syntax:

mp_grid_clear_rectangle(id, x1, y1, x2, y2);


Argument Description
id Index of the mp_grid that is to be used
x1 The x coordinate of the left side of the rectangle to check.
y1 The y coordinate of the top side of the rectangle to check.
x2 The x coordinate of the right side of the rectangle to check.
y2 The x coordinate of the bottom side of the rectangle to check.


Returns: Boolean.


Description

With this function you can define an area in room coordinates which will then clear the corresponding cells in the specified mp_grid. Even if a cell partially falls within the defined rectangular region it will be cleared.


Example:

mp_grid_clear_rectangle(grid, 0, 0, 100, 200);

The above code will mark as free all cells of the mp_grid indexed in the variable "grid" that fall within the area 0,0 to 100,200.


Back: Motion Planning
Next: mp_grid_to_ds_grid
© Copyright YoYo Games Ltd. 2018 All Rights Reserved