Inherits from OGWBase : NSObject
Conforms to OGWNotifierDelegate
Declared in OGWEntity.h

Overview

An entity represents an object in the world. An entity has aspects to drive its logic and data, keyed values to store and exchange data.

Entities have an OGWEntityIdentity which gives entities a unique ID and thus safer yet fast way to reference other entities without having to store pointers to objects or perform expensive queries. The identity also ties an entity to a specific category, which allows entities to be grouped and enumerated by category.

Entities have only three basic properties, which could have been aspects but were added to the entity class itself for faster access and ease of use due to the fact that these are the most frequently used properties. These properties are position and previousPosition, rotation and previousRotation, boundingBox and boundingBoxInWorldCoordinates.

Tasks

Identity

World

View Delegate

Operations

Fundamental Properties

Internal Use Only

Properties

boundingBox

The bounding box is in local coordinated relative to the entity’s position. To make a 32x32 bounding box that extends equally in all directions with the position at the center:

entity.boundingBox = GWRectMake(-16, -16, 32, 32);

This avoids having to use a separate anchor point for the bounding box.

@property GWRect boundingBox

Return Value

The entity’s bounding box, in local coordinates.

Declared In

OGWEntity.h

boundingBoxInWorldCoordinates

The bounding box in world coordinates is obtained by adding the entity position to the boundingBox.origin.

@property (readonly) GWRect boundingBoxInWorldCoordinates

Return Value

The bounding box in world coordinates.

Declared In

OGWEntity.h

identity

The entity’s identity object.

@property (readonly) OGWEntityIdentity *identity

Return Value

The entity’s identity object.

Declared In

OGWEntity.h

position

The entity’s position, in world coordinates.

@property GWPoint position

Return Value

The entity’s position, in world coordinates.

Declared In

OGWEntity.h

previousPosition

The entity’s position (in world coordinates) in the previous step.

@property (readonly) GWPoint previousPosition

Return Value

The entity’s position (in world coordinates) in the previous step.

Declared In

OGWEntity.h

previousRotation

The entity’s rotation (in radians) in the previous step.

@property (readonly) GWFloat previousRotation

Return Value

The entity’s rotation (in radians) in the previous step.

Declared In

OGWEntity.h

rotation

The entity’s (z) rotation, in radians.

@property GWFloat rotation

Return Value

The entity’s (z) rotation, in radians.

Declared In

OGWEntity.h

viewDelegate

The view delegate receives position, rotation and other updates from the entity. This allows the view to be driven by the entity (and optionally converting units from OpenGW to view) rather than having to poll for changes.

@property (weak) id<OGWEntityViewDelegate> viewDelegate

Return Value

The entity’s view delegate.

Declared In

OGWEntity.h

world

The world to which the entity was added.

@property (weak) OGWWorld *world

Return Value

The world to which the entity was added.

See Also

Declared In

OGWEntity.h

Class Methods

entityWithCategory:

+ (id)entityWithCategory:(const OGWEntityCategory *)category

Instance Methods

postUpdate

- (void)postUpdate

preUpdate

- (void)preUpdate

removeFromWorld

Removes the entity from its world.

- (void)removeFromWorld

Declared In

OGWEntity.h