ALL 2: Tablets - Audio and Leap coding
- leprik9
- Apr 19, 2016
- 2 min read
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.

1.0 Tablets

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.

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".

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.
Comments