top of page

Semester 2 W6 | Scene change/Gaze trigger code

  • Writer: Soo Zhi Jing
    Soo Zhi Jing
  • Dec 31, 2020
  • 2 min read

Updated: Mar 6, 2021

I had no idea where to start in terms of coding this mechanism out, I searched up tutorials online before but in VR development, hand tracking resources are quite limited and there are very very few tutorials regarding it. I seek help from Minken again hoping he knows how to do so. Due to me crashing the initial file that's fully coded, I had to start from scratch again and the code that I tried to use and follow from before did not work. After meeting up with Minken, he thought me an easier way to code this trigger, which is something that is quite familiar to me. It is the box collider trigger! I have learnt this during previous semesters during game design and to be able to reuse this shed light to me as I know for a fact that I am comfortable using it. Since I have basic knowledge on it, I can easily understand Minken's teachings and now it is to just apply it. Before we came to this conclusion, we actually tried raycast method and line cast method but the box collider one the most straight forward and easier to understand.


This box collider method is to basically attach the box collider that is very long so that it will reach the trigger better to the oculus hand, and tag the receiving object as a trigger. What's left is to code what does the trigger do once it is activated. Once that is done, viola! the same method can be replicated. The action for this is that once users hovers over the graphics, animations will play. This can be used for supporting elements when the story is ongoing. Same as the Gaze trigger, all I had to do was to attach the box collider to the head which is also user's view and tag the trigger on the object I want to be triggered. In this case I was switch the code from triggering animation to a countdown 3 seconds scene change. When users gaze at a certain point for 3 secs, the scene changes to elsewhere. This will be utillised when users are saved by the silent heroes and are transported to their office (red office scene).


As stuck as I was due to the fact that there was not many tutorials on hand tracking for VR development in Unity, this method was something that really ease me from a lot of worries! Now I just have to continue and insert more mechanisms to complete the project!

Comentarios


© 2020 by rszhijing. Proudly created with Wix.com

bottom of page