Description

Calls the function when two or more entities come into colision. Return this object :

{
    over:
    out:
    result: {
        coincident: []
        lines: []
    }
}
  • over : The number of times that the entity hit the other entity
  • out : it is 1 if the entity does not affect other entity
  • result

    • coincident : Array containing the lines coinciding with the lines of the other entity. 0 corresponds to the first line from the first point of the polygon.
    • lines : Values in each line with other lines. Example

    [ false, false, {x: 32, y: 32}, "Coincident" ]

Here, it is testing the first line of the polygon entity A. We test the line with 4 sides polygon entity B :

  1. The first line of entity A does not intersect with the first line of entity B
  2. The first line of entity A does not intersect with the second line of entity B
  3. The first line of Entity A has an intersection at positions (32,32) with the third line entity B
  4. The first line of entity A coincides with the fourth line entity B

In this example, coincident object is :

coincident: [3]

The number of lines is equal to the order (n) of the polygon - 1.

Usage

Parameters

  • entity_model {EntityModel}

    Other entity

Returns

Object

Discussion