ALL 2: Tablets - Audio and Leap coding
In our story we used the leap to interact with audio logs. This is the main feature in the game, because without it, this is just a path to walk without an idea of what is going on. For the character controller we user the prefabs in unity. From "Assets" -> "Import Package" -> "Characters". Next thing we need to set up the scene is import the Tablet model and Leap Developer Package. For the Leap Dev Kit i used version 3.0 because of problems with the latest versions.
![](https://static.wixstatic.com/media/aa724d_6220514da01c43ad933ae8b1c268c555~mv1.jpg/v1/fill/w_980,h_532,al_c,q_85,usm_0.66_1.00_0.01,enc_auto/aa724d_6220514da01c43ad933ae8b1c268c555~mv1.jpg)
1.0 Tablets
![](https://static.wixstatic.com/media/aa724d_dd1e160b8af64e60b0c964c902f1d8b2~mv1.jpg/v1/fill/w_980,h_532,al_c,q_85,usm_0.66_1.00_0.01,enc_auto/aa724d_dd1e160b8af64e60b0c964c902f1d8b2~mv1.jpg)
2.0 Character Controller.
I had problems with making the leap child of FPS Controller because it made hands flat. A solution i came up with was to create a new empty object called "PlayerFollower (Leap)" and write a simple script to always follow the player. Adding the Leap prefab as a child worked in this case. Below i will show a snippet of the code.
![](https://static.wixstatic.com/media/aa724d_97d899d4fd454bd7aa5936f4cdff687f~mv1.png/v1/fill/w_980,h_531,al_c,q_90,usm_0.66_1.00_0.01,enc_auto/aa724d_97d899d4fd454bd7aa5936f4cdff687f~mv1.png)
It's a simple script that copies the coordinates of the FPSController. Next thing i had to do was to detect collision between the tablet and the hand. The way this it's done is adding a box collider to the tablet and then attaching the script "Hand Detection".
![](https://static.wixstatic.com/media/aa724d_23126402ea8c44aaadfba4419554c9eb.png/v1/fill/w_980,h_551,al_c,q_90,usm_0.66_1.00_0.01,enc_auto/aa724d_23126402ea8c44aaadfba4419554c9eb.png)
First we have the function isHand which checks is the object colliding with the leap and returns a bool va. After that in the OnTriggerEnter function will check if the tablet is colliding with a hand. If yes it will access the Audio Source and play the needed Log.
And this is it. After i spent some time playing with the positioning ot the LeapController and Audio we have basic collision working just fine.