OGWEntity Class Reference
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
-
identity
property
World
-
world
property
View Delegate
-
viewDelegate
property
Operations
Fundamental Properties
-
boundingBox
property -
boundingBoxInWorldCoordinates
property -
position
property -
previousPosition
property -
rotation
property -
previousRotation
property
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.
See Also
Declared In
OGWEntity.h
identity
The entity’s identity object.
@property (readonly) OGWEntityIdentity *identity
Return Value
The entity’s identity object.
See Also
Declared In
OGWEntity.h
position
The entity’s position, in world coordinates.
@property GWPoint position
Return Value
The entity’s position, in world coordinates.
See Also
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.
See Also
Declared In
OGWEntity.h
rotation
The entity’s (z) rotation, in radians.
@property GWFloat rotation
Return Value
The entity’s (z) rotation, in radians.
See Also
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