/// <summary> /// moves the entity taking collisions into account /// </summary> /// <returns><c>true</c>, if move actor was newed, <c>false</c> otherwise.</returns> /// <param name="motion">Motion.</param> public bool move(Vector2 motion) { if (_collider == null) { return(false); } var didCollide = false; // fetch anything that we might collide with at our new position entity.transform.position += motion; // fetch anything that we might collide with us at our new position var neighbors = Physics.boxcastBroadphase(_collider.bounds, _collider.collidesWithLayers); foreach (var neighbor in neighbors) { if (_collider.overlaps(neighbor)) { didCollide = true; notifyTriggerListeners(_collider, neighbor); } } return(didCollide); }