physics_particle_delete_region_poly

Delete all particles from a polygonal area within the physics simulation.

Syntax:

physics_particle_delete_region_poly(pointList)


Argument Description
pointList A ds_list of points to use to create the polygon.


Returns: N/A


Description

With this function you can delete (remove) all the particles that fall within the bounds of the defined polygonal area from the physics simulation in the current room. The function takes a (previously created) ds_list() containing the x/y position of each point of the polygon, with the even numbered positions in the list being the x coordinates, and odd numbered positions the y coordinates, ie: for a triangle, your list would have six entries, with entry 0, 2, and 4 being the x coordinates and 1, 3, and 5 being the y coordinates. The polygon will then be used to delete all the particles that fall within the defined area.

Note that the polygon defined must have at least three points, and at most 8.


Example:

var list = ds_list_create(p_list);
for (var i = 0; i < 5; i ++;)
   {
   ds_list_add(p_list, mx[i]);
   ds_list_add(p_list, my[i]);
   }
physics_particle_delete_region_poly(p_list);
ds_list_destroy(p_list);

The above code will delete all particles found in the polygonal area defined by the points added to the ds_list.


Back: Soft Body Particles
Next: physics_particle_draw
© Copyright YoYo Games Ltd. 2019 All Rights Reserved