Inherits from NSObject
Declared in KKAcceleration.h

Overview

Contains the current accelerometer values. You can access the raw values as reported by the accelerometer, the smoothed values which have a low-pass filter applied to them (reacts slowly to sudden acceleration, averages the continous acceleration), or the instantaneous values which have a high-pass filter applied to them (reacts mostly to sudden acceleration, little to continuous acceleration). The filtering algorithm for smoothed and instantaneous values is only run once per frame, and only when you access one of the smoothed or instantaneous properties.

See the Event Handling Guide for iOS for more information about high and low pass filtering applied to the smoothed and instantaneous values: http://developer.apple.com/library/ios/#documentation/EventHandling/Conceptual/EventHandlingiPhoneOS/MotionEvents/MotionEvents.html#//apple_ref/doc/uid/TP40009541-CH4-SW1

Acceleration along the axis' is in G’s (gravitational force). According to Apple: “A G is a unit of gravitation force equal to that exerted by the earth’s gravitational field (9.81 m s−2).”

Tasks

  •   timestamp

    The timeStamp when the accelerometer was last sampled.

    property
  •   rawX

    Raw acceleration in G’s along the x axis. Value is already transformed to current device orientation.

    property
  •   rawY

    Raw acceleration in G’s along the y axis. Value is already transformed to current device orientation.

    property
  •   rawZ

    Raw acceleration in G’s along the z axis.

    property
  •   x

    Same as rawX.

    property
  •   y

    Same as rawY.

    property
  •   z

    Same as rawZ.

    property
  •   smoothedX

    Smoothed value using a low-pass filter influenced by the filteringFactor property. Smoothed values are averaged over several frames and responds barely to sudden changes of motion (eg shaking or dropping the device). Value is already transformed to current device orientation.

    property
  •   smoothedY

    Smoothed value using a low-pass filter influenced by the filteringFactor property. Smoothed values are averaged over several frames and responds barely to sudden changes of motion (eg shaking or dropping the device). Value is already transformed to current device orientation.

    property
  •   smoothedZ

    Smoothed value using a low-pass filter influenced by the filteringFactor property. Smoothed values are averaged over several frames and responds barely to sudden changes of motion (eg shaking or dropping the device).

    property
  •   instantaneousX

    Instantaneous acceleration value obtained from a high-pass filter. This value approximates the instant motion of the device with the constant effect of gravity filtered out, and reacts strongy to sudden changes of motion (eg shaking or dropping the device). Value is already transformed to current device orientation.

    property
  •   instantaneousY

    Instantaneous acceleration value obtained from a high-pass filter. This value approximates the instant motion of the device with the constant effect of gravity filtered out, and reacts strongy to sudden changes of motion (eg shaking or dropping the device). Value is already transformed to current device orientation.

    property
  •   instantaneousZ

    Instantaneous acceleration value obtained from a high-pass filter. This value approximates the instant motion of the device with the constant effect of gravity filtered out, and reacts strongy to sudden changes of motion (eg shaking or dropping the device).

    property
  •   filteringFactor

    The filtering factor used for high & low pass filtering. Determines how strongly raw values affect the filtered acceleration values. A filteringFactor of 0.1f means that only 10% of the raw values per update will be added to the running acceleration values. In other words the values are smoothed out over 10 updates (frames).

    property
  • – reset

    Sets all acceleration values to 0, including internal states. Call this method after an interruption in your application, for example the pause menu or starting a new level.

  • – setAccelerationWithTimestamp:x:y:z:

Properties

filteringFactor

The filtering factor used for high & low pass filtering. Determines how strongly raw values affect the filtered acceleration values. A filteringFactor of 0.1f means that only 10% of the raw values per update will be added to the running acceleration values. In other words the values are smoothed out over 10 updates (frames).

@property (nonatomic) double filteringFactor

Declared In

KKAcceleration.h

instantaneousX

Instantaneous acceleration value obtained from a high-pass filter. This value approximates the instant motion of the device with the constant effect of gravity filtered out, and reacts strongy to sudden changes of motion (eg shaking or dropping the device). Value is already transformed to current device orientation.

@property (nonatomic, readonly) double instantaneousX

Declared In

KKAcceleration.h

instantaneousY

Instantaneous acceleration value obtained from a high-pass filter. This value approximates the instant motion of the device with the constant effect of gravity filtered out, and reacts strongy to sudden changes of motion (eg shaking or dropping the device). Value is already transformed to current device orientation.

@property (nonatomic, readonly) double instantaneousY

Declared In

KKAcceleration.h

instantaneousZ

Instantaneous acceleration value obtained from a high-pass filter. This value approximates the instant motion of the device with the constant effect of gravity filtered out, and reacts strongy to sudden changes of motion (eg shaking or dropping the device).

@property (nonatomic, readonly) double instantaneousZ

Declared In

KKAcceleration.h

rawX

Raw acceleration in G’s along the x axis. Value is already transformed to current device orientation.

@property (nonatomic, readonly) double rawX

Declared In

KKAcceleration.h

rawY

Raw acceleration in G’s along the y axis. Value is already transformed to current device orientation.

@property (nonatomic, readonly) double rawY

Declared In

KKAcceleration.h

rawZ

Raw acceleration in G’s along the z axis.

@property (nonatomic, readonly) double rawZ

Declared In

KKAcceleration.h

smoothedX

Smoothed value using a low-pass filter influenced by the filteringFactor property. Smoothed values are averaged over several frames and responds barely to sudden changes of motion (eg shaking or dropping the device). Value is already transformed to current device orientation.

@property (nonatomic, readonly) double smoothedX

Declared In

KKAcceleration.h

smoothedY

Smoothed value using a low-pass filter influenced by the filteringFactor property. Smoothed values are averaged over several frames and responds barely to sudden changes of motion (eg shaking or dropping the device). Value is already transformed to current device orientation.

@property (nonatomic, readonly) double smoothedY

Declared In

KKAcceleration.h

smoothedZ

Smoothed value using a low-pass filter influenced by the filteringFactor property. Smoothed values are averaged over several frames and responds barely to sudden changes of motion (eg shaking or dropping the device).

@property (nonatomic, readonly) double smoothedZ

Declared In

KKAcceleration.h

timestamp

The timeStamp when the accelerometer was last sampled.

@property (nonatomic, readonly) NSTimeInterval timestamp

Declared In

KKAcceleration.h

x

Same as rawX.

@property (nonatomic, readonly) double x

Declared In

KKAcceleration.h

y

Same as rawY.

@property (nonatomic, readonly) double y

Declared In

KKAcceleration.h

z

Same as rawZ.

@property (nonatomic, readonly) double z

Declared In

KKAcceleration.h

Instance Methods

reset

Sets all acceleration values to 0, including internal states. Call this method after an interruption in your application, for example the pause menu or starting a new level.

- (void)reset

Declared In

KKAcceleration.h

setAccelerationWithTimestamp:x:y:z: