XRD Week 10
Repository link: https://github.com/composer404/XRArcade
XRD Week 10
After the first mini project was considered as done, we have decided to do more by brainstorming different ideas. We have come up with another idea which was a Dart Game. Dart is considered to be one of the easiest and fun games around the world. It always starts with 501 points, where the player has 3 throws at each round. The points are subtracted from the total number based on the hit of that throw. The ring inside counts as triple, where the ring outside counts as a double. The player needs to keep in mind that the triple 20 gives 60 where the bull's eye is worth only 50. It was also easier to get it to work as we already had hand tracking from the XR toolkit already applied to move the objects around. Moreover, all the other tools needed for the Dart were also available in the package. /Oliwer
We started the process of creation simply by getting the appropriate models such as the board and the throw. The elements have been unpacked, resized and turned into the prefabs.
| Dart board with the throws |
Starting off with the throw, a rigidbody has been added to adjust its mass but also to be able to throw with the hand at the other object. Besides, the mesh collider has been applied to focused specifically on the front of throw where it is supposed to hit the board. To make sure that the throw will stop when it hits the one of the areas on the board, it was necessary to make sure that it uses a script with the OnColliderEnter method to be able to collide and stop on the other object which is the board. Besides, a grabbable and hand grab interactable scripts has been applied to the throw to be able to grab it with the VR hand. The throw also has a physics grabbable script to be able to throw it as an object. The rigidbody and the grabbable scripts have been assigned in the physics script to be able to specify the part it should be interacting with. The phycics grabbable became a part of the hand grab interactable to be able to grab it, carry and throw at the board. /Oliwer
As we were also a bit lucky because the board was already divided into the separate elements into the areas where the points are meant to be scored, it was possible to add a mesh collider to each of them to interact with the throw when it hits one of them. The script with the serializefield has been made to specify the number of points that need to be given for each of the elements. The dart manager has been created to be able to set the number of points at the start of the game, which should be 501 with the method that is supposed to subtract the points from each element. Besides, the functionality to display the current and best score has been added to let the player know about the score in the form of an aid, instead of reading it from the board. An anchor as been also added to the board to be able to grab, carry and place it somewhere according to the player with the virtual hand. /Oliwer
In the context of a memory game, we added the game logic with visual elements. We started out by inventing and writing an algorithm that is executed in a loop. After selecting the start button, the system randomly selects one of the buttons, changes the color of its material and adds it to the list that stores the current sequence of movements. Additionally, each button has an assigned sound to diversify the gameplay. For this purpose, a dictionary has been created with buttons (gameObject) and an assigned sound (audioSource), thanks to which we can easily obtain the sound based on the button that is currently pressed. In the next step, the user presses buttons which are successively added to the list. After making as many moves as there are in sequence, the system compares both lists with each other. If the elements overlap, another element is added to the sequence and the whole thing repeats. If user sequence is incorrect the system display information and lists are cleared. /by Przemek
The whole thing was easily implemented by creating a MemoryGameManager dealing with the entire logic and the PointableUnityWrapper components and their When Select event added to each button. In addition, when the system presents sequence, the PokeInteracable component is disabled, so that the user does not disturb the entire process. In addition, the game is also equipped with a round counter and a record to motivate the user to further attempts. /by Przemek
Author: Oliwer Szefer
Comments
Post a Comment