Inherits from OGWAspect : NSObject
Conforms to OGWUpdateableAspect
Declared in OGWContactAspect.h

Overview

Performs contact tests and notifies delegates. Requires OGWWorldContactAspect to be on the world’s aspect list.

The OGWContactDelegate messages are sent to delegates only if they implement the selector. For best performance do not implement OGWContactDelegate selectors not used by your code.

Tip: prefer to test entities from a heavily populated category against those in a sparsely populated category, and avoid testing both ways. For example it is more efficient to test the player contacting with any enemy rather than each enemy testing for contact with the player. If you need both entities made aware of the contact, have a custom player contact delegate aspect send a message to a custom enemy entity’s aspect.

Instance Methods

addTest:againstCategory:delegate:

Adds a contact test to be performed every simulation step. Same as

- (void)addTest:(OGWContactTest)test againstCategory:(const OGWEntityCategory *)category delegate:(OGWAspect<OGWContactDelegate> *)delegate

Parameters

test

The OGWContactTest defining the type of test to perform.

category

The test is performed against entities in this category.

delegate

The delegate aspect that receives the contact event messages defined in the OGWContactDelegate protocol. The aspect needs to implement at least one of the protocol messages.

Declared In

OGWContactAspect.h

addTest:againstCategory:interval:delegate:

Adds a contact test to be performed at a given interval (in steps).

- (void)addTest:(OGWContactTest)test againstCategory:(const OGWEntityCategory *)category interval:(GWStep)interval delegate:(OGWAspect<OGWContactDelegate> *)delegate

Parameters

test

The OGWContactTest defining the type of test to perform.

category

The test is performed against entities in this category.

interval

How often (in steps) the test should be performed. For example if interval is 2 the contact test will be performed every other step. If interval is 0 or 1 it behaves the same as calling the addTest:againstCategory:delegate: method.

delegate

The delegate aspect that receives the contact event messages defined in the OGWContactDelegate protocol. The aspect needs to implement at least one of the protocol messages.

Declared In

OGWContactAspect.h

removeTestsForDelegate:

Removes all tests that a given delegate has scheduled.

- (void)removeTestsForDelegate:(OGWAspect<OGWContactDelegate> *)delegate

Parameters

delegate

The delegate that wants its scheduled contact tests to be removed.

Declared In

OGWContactAspect.h

removeTestsForDelegate:againstCategory:

Removes tests against a certain category that a given delegate has scheduled.

- (void)removeTestsForDelegate:(OGWAspect<OGWContactDelegate> *)delegate againstCategory:(OGWEntityCategory *)category

Parameters

delegate

The delegate that wants its scheduled contact tests to be removed.

category

The category that should no longer be queried for contacts.

Declared In

OGWContactAspect.h