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

Overview

Kinematics movement, updates position based on velocity.

The velocity can be clamped to minimumVelocity and maximumVelocity vectors, to prevent velocity from “exploding”. This clamping can be disabled temporarily without having to modify both vectors via ignoresMinMaxVelocity.

Velocity is normally influenced by gravity if OGWWorldGravityAspect is added to the world. Gravity can be ignored or scaled via ignoresGravity and gravityScale. Ignoring gravity is the same as setting gravity scale to 0,0 but can be set without having to change the actual scale, this may be more desirable in cases where the object setting the gravity scale is not the same as the one that wants gravity to be temporarily ignored.

After applying gravity and velocity clamping, the resulting velocity can be modified via speedFactor to speed up or slow down entity movement without changing its gravitational behavior, meaning the entity will jump the same height, but reach the height faster or slower. This can be used for “fast forward” or “slow motion” effects on particular entities. Though if the intention is to speed up or slow down the entire simulation it would be easier to simply call world simulate more or less often.

Tasks

Delegate

Velocity

Speed

Gravity

Properties

delegate

A delegate aspect that receives the aspect:kinematicsDidIntegratePosition:velocity:axis: selector of the OGWKinematicsDelegate protocol. The selector is sent once per axis.

@property (weak) OGWAspect<OGWKinematicsDelegate> *delegate

Return Value

The delegate, or nil if there’s no delegate set.

Declared In

OGWKinematicsAspect.h

gravityScale

Gravity scale is multiplied with gravity before applying the result to velocity. It changes how strongly the entity is influenced by gravity without having to change gravity itself. You can use this to simulate the effect of a heavier or lighter entity due to a powerup, for example.

@property GWFloat gravityScale

Return Value

The current gravity scale.

Declared In

OGWKinematicsAspect.h

ignoresGravity

Set this flag to (temporarily) ignore gravity, ie velocity is not integrated with gravity and gravityScale.

@property BOOL ignoresGravity

Return Value

Whether gravity is currently ignored.

Declared In

OGWKinematicsAspect.h

ignoresMinMaxVelocity

Set this flag to (temporarily) ignore the velocity cap. This disables the clamping of velocity to minimumVelocity and maximumVelocity.

@property BOOL ignoresMinMaxVelocity

Return Value

YES if velocity is capped to be at least minimumVelocity and at most maximumVelocity. NO if velocity is not clamped/capped at all.

Declared In

OGWKinematicsAspect.h

maximumVelocity

The maximum allowed velocity.

@property GWVector maximumVelocity

Return Value

The maximum allowed velocity.

Declared In

OGWKinematicsAspect.h

minimumVelocity

The minimum allowed velocity.

@property GWVector minimumVelocity

Return Value

The minimum allowed velocity.

Declared In

OGWKinematicsAspect.h

speedFactor

Speed factor can be used to (temporarily) speed up or slow down the entity without affecting its flight path, jump height, etc.

@property GWFloat speedFactor

Return Value

The speedFactor for the entity. Velocity is multiplied with speedFactor after applying gravity and clamping the velocity.

Declared In

OGWKinematicsAspect.h

velocity

The current velocity of the entity.

@property GWVector velocity

Return Value

The current velocity of the entity.

Declared In

OGWKinematicsAspect.h