Controls the player's camera based on the player's hand and hand orientation (i.e are they left or right handed), in relation to the "Kinect point" (note the Kinect point will change based on hand orientation to either the left or right side of the player respectively) which is a pre-defined point in 3D space (positioned just under the left or right shoulder, where the player generally finds it most comfortable to position their hand).
More...
List of all members.
Public Member Functions |
void | Start () |
| Initialises the KinectControl fields.
|
void | Update () |
| The update loop for the KinectControl tracks the players hand, and updates the player's camera and rotation accordingly.
|
void | positionKinectRig () |
| Positions the kinect rig in the optimum position (dependant on which hand orientation is being used).
|
void | calculateHandDisplacement (Vector3 _handPoint) |
| Calculates the hand displacement from the Kinect point and the hand point within screen space (for player rotations).
|
void | calculateCamPitch (GameObject _playerCam) |
| Calculates the camera pitch dependent on the y-axis position of the hand (the amount it is displaced from the Kinect point).
|
void | calculatePlayerYaw (GameObject _player) |
| Calculates the players yaw (it's y-rotation) dependant on the player's hand displacement from the Kinect Point in the x-axis. I.e. if the player's hand is right of the kinect point the entire player (i.e. camera, items, such as gun) will rotate clockwise.
|
void | calculateCamRoll (GameObject _playerCam) |
| Calculates the cameras roll (aka the player's lean left or right) dependant on the rotation of the player's head. I.e. if the player leans left (or even simply leans their head to the left the camera, will tilt/roll to the left).
|
void | OnTriggerEnter (Collider _colObject) |
| Checks if the players hand has entered the pickup space. The pickup space is a box collider in front of the player, once the player reaches (and collides) with the box the player can pick up an object or use (for instance open a door) an element within the game.
|
void | OnTriggerExit (Collider _colObject) |
| Checks if the players hand has left the pickup space, in which case they will not be able to pick up an item or use a door (as their hand is not far enough forward, i.e. it is outside the pick up space).
|
float | getHandPointX () |
| Gets the player's hand in the x-axis.
|
float | getHandPointY () |
| Gets the player's hand in the y-axis.
|
bool | getIsInPickupSpace () |
| Gets if the player's hand is within the pickup space or not.
|
Detailed Description
Controls the player's camera based on the player's hand and hand orientation (i.e are they left or right handed), in relation to the "Kinect point" (note the Kinect point will change based on hand orientation to either the left or right side of the player respectively) which is a pre-defined point in 3D space (positioned just under the left or right shoulder, where the player generally finds it most comfortable to position their hand).
- Author:
- Alexander Poolton
- Version:
- 6.0
- Date:
- 21/7/2011
Member Function Documentation
void KinectControl::calculateCamPitch |
( |
GameObject |
_playerCam | ) |
[inline] |
Calculates the camera pitch dependent on the y-axis position of the hand (the amount it is displaced from the Kinect point).
- Parameters:
-
[in] | _playerCam | The camera (the player's first-person viewpoint) to pitch up or down. |
void KinectControl::calculateCamRoll |
( |
GameObject |
_playerCam | ) |
[inline] |
Calculates the cameras roll (aka the player's lean left or right) dependant on the rotation of the player's head. I.e. if the player leans left (or even simply leans their head to the left the camera, will tilt/roll to the left).
- Parameters:
-
[in] | _playerCam | The player's camera to roll. |
void KinectControl::calculateHandDisplacement |
( |
Vector3 |
_handPoint | ) |
[inline] |
Calculates the hand displacement from the Kinect point and the hand point within screen space (for player rotations).
- Parameters:
-
[in] | _handPoint | The hand point to check displacement against. |
void KinectControl::calculatePlayerYaw |
( |
GameObject |
_player | ) |
[inline] |
Calculates the players yaw (it's y-rotation) dependant on the player's hand displacement from the Kinect Point in the x-axis. I.e. if the player's hand is right of the kinect point the entire player (i.e. camera, items, such as gun) will rotate clockwise.
- Parameters:
-
[in] | _player | The player object to rotate. |
float KinectControl::getHandPointX |
( |
| ) |
[inline] |
Gets the player's hand in the x-axis.
- Returns:
- m_handPointX Returns the player's hand position in the x-axis.
float KinectControl::getHandPointY |
( |
| ) |
[inline] |
Gets the player's hand in the y-axis.
- Returns:
- m_handPointY Returns the player's hand position in the y-axis.
bool KinectControl::getIsInPickupSpace |
( |
| ) |
[inline] |
Gets if the player's hand is within the pickup space or not.
- Returns:
- m_isInPickupSpace Returns if the player's hand is within the pickup space or not.,
void KinectControl::OnTriggerEnter |
( |
Collider |
_colObject | ) |
[inline] |
Checks if the players hand has entered the pickup space. The pickup space is a box collider in front of the player, once the player reaches (and collides) with the box the player can pick up an object or use (for instance open a door) an element within the game.
- Parameters:
-
[in] | _colObject | The object colliding with the pickup space box collider. |
void KinectControl::OnTriggerExit |
( |
Collider |
_colObject | ) |
[inline] |
Checks if the players hand has left the pickup space, in which case they will not be able to pick up an item or use a door (as their hand is not far enough forward, i.e. it is outside the pick up space).
- Parameters:
-
[in] | _colObject | The object colliding with the pickup space box collider. |
The documentation for this class was generated from the following file:
- C:/Users/Alex/Desktop/Gamepad Classes/KinectControl.cs