MuvslideInput

Version: 1.0.0.0

class MuvslideInput

class ForestIndieGames.Muvslide.MuvslideInput

Every MuvslideConnection instance contains an instance of this class. Use this instance to read the input information received from the Muvslide App.

An instance of this class stores the Muvslide App input, manages the noise filtering, and allows to configure some input preferences.

You cannot create new instances of this class; neither inherit from it.


Methods

IsNewMotionAvailable

bool IsNewMotionAvailable ()

Returns 'true' if there is new motion information available, that includes orientation and acceleration information.

If you use this method and it finds new information, i.e. it returns 'true', the information will be marked as read, causing that the next time you call this method it will return 'false' unless there is newer information available.

You can continuously call this method in order to know if you need to react to the current motion information available or not.

Returns 'true' if there is new motion information available, otherwise 'false'.

 

IsNewScrollAvailable

bool IsNewScrollAvailable ()

Returns 'true' if there is new scroll information available, that includes continuous touch gestures over the smartphone's screen.

If you use this method and it finds new information, i.e. it returns 'true', the information will be marked as read, causing that the next time you call this method it will return 'false' unless there is newer information available.

You can continuously call this method in order to know if you need to react to the current scroll information available or not.

Returns 'true' if there is new scroll information available, otherwise 'false'.

 

IsNewFlingAvailable

bool IsNewFlingAvailable ()

Returns 'true' if there is new fling information available, that includes continuous touch gestures over the smartphone's screen that ended by raising the finger quickly.

If you use this method and it finds new information, i.e. it returns 'true', the information will be marked as read, causing that the next time you call this method it will return 'false' unless there is newer information available.

You can continuously call this method in order to know if you need to react to the current fling information available or not.

Returns 'true' if there is new fling information available, otherwise 'false'.

 

IsNewTapDownAvailable

bool IsNewTapDownAvailable ()

Returns 'true' if a new tap down gesture was registered.

If you use this method and it finds new information, i.e. it returns 'true', the information will be marked as read, causing that the next time you call this method it will return 'false' unless there is newer information available.

You can continuously call this method in order to know if you need to react to a new tap down or not.

Returns 'true' if a new tap down gesture was registered, otherwise 'false'.

 

IsNewTapUpAvailable

bool IsNewTapUpAvailable ()

Returns 'true' if a new tap up gesture was registered.

If you use this method and it finds new information, i.e. it returns 'true', the information will be marked as read, causing that the next time you call this method it will return 'false' unless there is newer information available.

You can continuously call this method in order to know if you need to react to a new tap up or not.

Returns 'true' if a new tap up gesture was registered, otherwise 'false'.

 

GetScrollStartPositionX

int GetScrollStartPositionX ()

Returns the horizontal position in pixels where the last scroll gesture started. The left margin of the Muvslide App gesture area corresponds to value 0.

Returns The horizontal position in pixels where the last scroll gesture started.

 

GetScrollStartPositionY

int GetScrollStartPositionY ()

Returns the vertical position in pixels where the last scroll gesture started. The upper margin of the Muvslide App gesture area corresponds to value 0.

Returns The vertical position in pixels where the last scroll gesture started.

 

GetScrollEndPositionX

int GetScrollEndPositionX ()

Returns the horizontal position in pixels where the last scroll gesture ended. The left margin of the Muvslide App gesture area corresponds to value 0.

Returns The horizontal position in pixels where the last scroll gesture ended.

 

GetScrollEndPositionY

int GetScrollEndPositionY ()

Returns the vertical position in pixels where the last scroll gesture ended. The upper margin of the Muvslide App gesture area corresponds to value 0.

Returns The vertical position in pixels where the last scroll gesture ended.

 

GetLastScrollDistanceX

int GetLastScrollDistanceX ()

Returns the horizontal distance in pixels that has been scrolled since the last scroll event registered in the Muvslide App.

It is not the same as the difference between the scroll start and end positions because, for one scroll gesture, multiple scroll events are triggered in the Muvslide App.

Returns The horizontal distance in pixels for the last scroll event registered.

 

GetLastScrollDistanceY

int GetLastScrollDistanceY ()

Returns the vertical distance in pixels that has been scrolled since the last scroll event registered in the Muvslide App.

It is not the same as the difference between the scroll start and end positions because, for one scroll gesture, multiple scroll events are triggered in the Muvslide App.

Returns The vertical distance in pixels for the last scroll event registered.

 

GetFlingStartPositionX

float GetFlingStartPositionX ()

Returns the horizontal position in pixels where the last fling gesture started. The left margin of the Muvslide App gesture area corresponds to value 0.

Returns The horizontal position in pixels where the last fling gesture started.

 

GetFlingStartPositionY

float GetFlingStartPositionY ()

Returns the vertical position in pixels where the last fling gesture started. The upper margin of the Muvslide App gesture area corresponds to value 0.

Returns The vertical position in pixels where the last fling gesture started.

 

GetFlingEndPositionX

float GetFlingEndPositionX ()

Returns the horizontal position in pixels where the last fling gesture ended. The left margin of the Muvslide App gesture area corresponds to value 0.

Returns The horizontal position in pixels where the last fling gesture ended.

 

GetFlingEndPositionY

float GetFlingEndPositionY ()

Returns the vertical position in pixels where the last fling gesture ended. The upper margin of the Muvslide App gesture area corresponds to value 0.

Returns The vertical position in pixels where the last fling gesture ended.

 

GetFlingSpeedX

float GetFlingSpeedX ()

Returns the horizontal speed of the fling gesture in a range from 0 to 1, being 1 the maximum fling speed the smartphone can detect.

Returns The horizontal speed of the fling gesture in a range from 0 to 1.

 

GetFlingSpeedY

float GetFlingSpeedY ()

Returns the vertical speed of the fling gesture in a range from 0 to 1, being 1 the maximum fling speed the smartphone can detect.

Returns The vertical speed of the fling gesture in a range from 0 to 1.

 

Calibrate

void Calibrate ()

Marks the next smartphone's orientation received as the neutral position. It takes into account the camera's orientation stored using method NotifyCameraOrientationInRadians or NotifyCameraOrientationInDegrees.

 

GetOrientationDegrees

float[] GetOrientationDegrees ()

Returns an array of 3 values that indicate the smartphone's orientation in degrees. The values correspond to the rotation in X, Y, and Z in that order.

Returns The smartphone's rotation in degrees for axes X, Y, and Z in that order.

 

GetOrientationRadians

float[] GetOrientationRadians ()

Returns an array of 3 values that indicate the smartphone's orientation in radians. The values correspond to the rotation in X, Y, and Z in that order.

Returns The smartphone's rotation in radians for axes X, Y, and Z in that order.

 

NotifyCameraOrientationInRadians

void NotifyCameraOrientationInRadians (float x, float y, float z)

Notifies the Muvslide API about changes in the camera orientation. The orientation the user expects to transmit to the application depends on the current camera orientation because it tells where the user "stands".

In order to continue reading the orientation in the way the user expects, any changes in the camera orientation need to be transmited to the Muvslide API by using this method.

By default, the Muvslide API assumes the camera has no rotation, i.e. the orientation in X, Y, and Z is 0.

Parameters

Parameter Description
float x The camera's X orientation in radians.
float y The camera's Y orientation in radians.
float z The camera's Z orientation in radians.

 

NotifyCameraOrientationInDegrees

void NotifyCameraOrientationInDegrees (float x, float y, float z)

Notifies the Muvslide API about changes in the camera orientation. The orientation the user expects to transmit to the application depends on the current camera orientation because it tells where the user "stands".

In order to continue reading the orientation in the way the user expects, any changes in the camera orientation need to be transmited to the Muvslide API by using this method.

By default, the Muvslide API assumes the camera has no rotation, i.e. the orientation in X, Y, and Z is 0.

Parameters

Parameter Description
float x The camera's X orientation in degrees.
float y The camera's Y orientation in degrees.
float z The camera's Z orientation in degrees.

 

GetAcceleration

float[] GetAcceleration ()

Returns an array of 3 values that indicate the smartphone's linear acceleration. The values correspond to the acceleration in X, Y, and Z in that order.

The acceleration returned does not include the constant gravity acceleration.

Returns The smartphone's linear acceleration for axes X, Y, and Z in that order.

 

GetKalmanFilterForOrientation

ForestIndieGames.Muvslide.KalmanFilter GetKalmanFilterForOrientation ()

Returns the instance of the KalmanFilter class used to filter the orientation information. Use this instance to modify the parameters of the filter in order to reduce noise or gain speed.

Returns The instance of the KalmanFilter class used to filter the orientation information.

 

GetKalmanFilterForAcceleration

ForestIndieGames.Muvslide.KalmanFilter GetKalmanFilterForAcceleration ()

Returns the instance of the KalmanFilter class used to filter the acceleration information. Use this instance to modify the parameters of the filter in order to reduce noise or gain speed.

Returns The instance of the KalmanFilter class used to filter the acceleration information.

 

UseUnityCoordinateSystem

void UseUnityCoordinateSystem (bool value)

Changes the coordinate system used by the Muvslide API.

A usual coordinate system considers the positive side of the X axis as the line going from the user to the right, the Y axis as the line going to the back of the user, and the Z axis as the line going up from the user. However, Unity coordinate system considers the positive side of the Y axis as the line going up from the user, and the positive side of the Z axis as the line going to the front of the user.

Normally you do not want to keep changing from one coordinate system to the other, but note that if you do, the filters will interpret it as movement, causing unexpected signals for a few seconds.

By default, the Muvslide API works based on the Unity coordinate system.

Parameters

Parameter Description
bool value Send 'false' to disable the Unity coordinate system.