Unity3d for VR Learning (3): Storm mirror PC input small makeover – DIY, clothed

Source: Internet
Author: User

When doing a hand tour, 80% of the time is in the PC debugging, such as business logic, AI algorithm, core play and so on.

Get the magic Mirror provided by the demo, dizzy, must be installed on the Android machine, to debug, the reason, there are three:

    1. Need to use the phone gyroscope
    2. Need to use Bluetooth handle
    3. Need to use the mirror's convex lens

These are objective reasons, but after each pack, install Android, and then wear the head, Debug, log what are not see clearly, hehe.

So we start to transform the input shortcut keys, so that you can easily simulate the phone gyro input, analog Bluetooth input, analog non-VR mode switching.

1 Analog Phone Gyroscope input

This has an existing hidden code in the Mojing.cs, in the Updatestate () function.

    • Shortcut key F:ok key
    • Shortcut key alt: Hold, mouse simulate gazepostion displacement
    • Shortcut key CTRL: Hold, mouse simulate gazepostion rotate
2 Analog Bluetooth input

After learning the Mojinginputmanager.onbuttondown\onbuttonup, know that as long as the passing of the past string can be used/separated, the first bit temporarily unused, the second mojingkeycode the number of predefined definitions.

    • Shortcut keys WASD: analog bluetooth
    • Shortcut key Q: Analog bluetooth OK
3 analog non-VR mode switching

VR mode switching is achieved by setting Mojing.SDK.VRModeEnabled, which is the principle of hiding or displaying the visibility of the left and right camera and center camera. Found in the Demo.cs script, has encapsulated the switch and return the main menu function, call can be:gameobject.findobjectoftype<demo> (). Togglevrmode ();

    • Shortcut R: Analog switch VR Mode
    • Shortcut B: Simulate back to main menu

Borrow the network a word: VR development, more than the app development, one more camera. Setting up the debugging environment will be much better.

SOURCE Download: MojingInputManagerEditor.cs

To use: Add Mojinginputmanagereditor script to Mojinginputmanager.prefab and click Apply.


Reprint please specify transfer from "Unity3d for VR Learning" (3): Storm mirror PC input small makeover – DIY, clothed

Unity3d for VR Learning (3): Storm mirror PC input small makeover – DIY, clothed

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.