lewisje / renderengine

Automatically exported from code.google.com/p/renderengine
MIT License
0 stars 0 forks source link

Modify ColliderComponent with collision flags #45

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
The arose while working on Issue 44

Modified the execute() method of ColliderComponent to report 3 arguments:

  * Collision Object
  * Time of Collision
  * Collision Flags

The third argument is new and will be used to determine collision types without 
using "instanceof" or isInstance() checks which can be slow.  Instead, we'll 
use the flags to determine if two objects can collide.  For example, if there's 
a player with flags "1111" (binary) and enemies 1 & 2 with "0010" and "0101" 
respectively, then a player can collide with enemy one and two.

Modifying the flags of the enemies to be "10010" and "10101" would still impact 
the player, but if we established something like a forcefield which has flags 
"10000", then only the enemies would collide with the forcefield, but the 
player wouldn't.  It should be noted that currently objects with the same flags 
cannot collide.  Maybe another flag needs to be put into place to allow this?

When two objects collide, the first object will be passed the flags of the 
second object.  These flags are arbitrary and can mean anything to the 
developer.  However, the operation is "(A & B) == B" results in a collision.  

The collision object is still passed as the first argument, so existing 
"instanceof" or "isInstance()" checks should continue to work.

Original issue reported on code.google.com by bfatt...@gmail.com on 9 Nov 2010 at 2:56

GoogleCodeExporter commented 8 years ago
Flags have been implemented and released with v1.5.2

Original comment by bfatt...@gmail.com on 23 Nov 2010 at 5:12

GoogleCodeExporter commented 8 years ago

Original comment by bfatt...@gmail.com on 23 Nov 2010 at 5:12