A VR multi-platform adaptation system and adaptation method based on Unity project

Through the VR multi-platform adaptation system of Unity Engineering, the problem of inconsistency of Android permissions, metadata and Activity between VR software development packages between different hardware platforms has been solved, cross-platform adaptation has been achieved, and the development and maintenance costs of enterprises have been reduced.

CN112148362BActive Publication Date: 2024-09-03SHENZHEN SHUNSHI WEIKUAI TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202011000811.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-09-22
Publication Date
2024-09-03
Estimated Expiration
2040-09-22

AI Technical Summary

Technical Problem

Existing VR software development kits have inconsistencies in Android permissions, metadata, and activities between different hardware platforms, resulting in increased software development complexity and increased enterprise development and maintenance costs.

Method used

Design a VR multi-platform adaptation system based on Unity engineering, including VR hardware platform packaging module, hardware input event detection module and interactive event response module. Android permissions and Activity are managed uniformly through the packaging module, and the detection module maps hardware input events and responds The module handles interactive events and achieves cross-platform adaptation.

Benefits of technology

It realizes the unified adaptation of VR software development packages between different hardware platforms, reduces development and maintenance costs, avoids the need to repeatedly modify development packages, and improves development efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112148362B
    Figure CN112148362B
Patent Text Reader

Abstract

The present invention discloses a VR multi-platform adaptation system and adaptation method based on Unity project, the system includes: VR hardware platform packaging module, used to package Android permissions, metadata and Activity required by VR software development kit, and generate Android software project; hardware input event detection module, used to detect input instruction information of VR hardware platform; interactive event response module, used to execute instruction information input by VR hardware platform, and complete interaction. This system solves the inconsistency of Android permissions and metadata required by VR software development kit, the inconsistency of Activity required by VR software development kit, the inconsistency of VR software development kit interactive event response event, and the inconsistency of VR software development kit interactive event response event, thereby completing the adaptation of VR software development kit and each VR hardware platform, without the need to repeatedly modify VR software development kit for each VR hardware platform, greatly reducing the development and maintenance costs of enterprises.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of virtual reality, and in particular to a VR multi-platform adaptation system and an adaptation method based on Unity project. Background Art

[0002] With the development of information technology, VR (Virtual Reality) has gradually entered people's lives. At present, there are many VR hardware headset manufacturers on the market, and each manufacturer has a corresponding VR software development kit, and different software development kits have different degrees of differences. Specifically: the VR software development kit detects inconsistent input events of the handle and the helmet; the VR software development kit interacts with events and responds to them inconsistently; the VR software development kit requires inconsistent Android permissions and metadata; the VR software development kit needs to use inconsistent Activities. In summary, this creates difficulties for software developers in research and development and increases the development and maintenance costs of enterprises. Summary of the invention

[0003] The main purpose of the present invention is to provide a multi-platform adaptation system and adaptation method based on Unity project, aiming to solve the technical problem of reducing enterprise development and maintenance costs.

[0004] The present invention proposes a VR multi-platform adaptation system based on Unity engineering, comprising:

[0005] VR hardware platform packaging module, used to package the Android permissions, metadata and Activities required by the VR software development kit and generate an Android software project;

[0006] Hardware input event detection module, used to detect input command information of VR hardware platform;

[0007] The interactive event response module is used to execute the command information input by the VR hardware platform to complete the interaction.

[0008] The present invention also provides a VR multi-platform adaptation method based on Unity project, comprising:

[0009] Obtain the current VR hardware platform information to obtain the specified VR software development kit, wherein the specified VR software development kit is to obtain the corresponding VR software development kit according to the current VR hardware platform information;

[0010] Hide other VR SDKs in the VR SDK collection except the specified VR SDK;

[0011] Change the AndroidManifest.xml file of the current VR hardware platform, generate an Android software project, and replace the Activity code in the Android software project according to the Activity code of the current VR hardware platform;

[0012] Get the rotation information of the helmet or handle, and move the cursor according to the rotation information;

[0013] Get the command information input by the helmet or handle, and perform the corresponding operation of the command information.

[0014] Preferably, the steps of changing the AndroidManifest.xml file of the current VR hardware platform and generating an Android software project include:

[0015] Create an AndroidManifest.xml file for the current VR hardware platform and add the permissions and metadata required for the specified VR hardware platform;

[0016] Store a Json file containing all VR hardware platform packaging data in the Unity project, which includes the AndroidManifest.xml file, packaging registration and version information of the current VR hardware platform;

[0017] Before packaging, copy the AndroidManifest.xml file to the Plugins / Android folder, add common data, and generate an Android software project.

[0018] Preferably, the step of hiding other VR software development kits in the VR software development kit set except for the specified VR software development kit includes:

[0019] Store a Json file containing all VR hardware platform package data in the Unity project, specifying the current VR hardware platform AndroidManifest.xml file, package registration, version information, and VR software development kit storage files, etc.

[0020] Get other VR hardware platform information from the Json file and hide other VR hardware platform information.

[0021] Preferably, the step of replacing the Activity code in the Android software project according to the Activity code of the current VR hardware platform includes:

[0022] After generating the Android software project, use regular expressions to

[0023] Find the first Activity tag in the AndroidManifest.xml file and copy the name attribute from it;

[0024] The current VR hardware platform stores an original MainActivity file locally, and changes the class inherited by MainActivity to the Activity with the copied name attribute.

[0025] The beneficial effects of the present invention are as follows: the inconsistency of Android permissions and metadata required by the VR software development kit and the inconsistency of Activities required to be used by the VR software development kit are solved through the VR hardware platform packaging module; the inconsistency of interactive event response events of the VR software development kit is solved through the hardware input event detection module; the inconsistency of interactive event response events of the VR software development kit is solved through the interactive event response module, thereby completing the adaptation of the VR software development kit to each VR hardware platform. Through this system, the VR software development kit can be used for each VR hardware platform after being developed or updated once, without the need to repeatedly modify the VR software development kit for each VR hardware platform, thereby greatly reducing the development and maintenance costs of the enterprise. BRIEF DESCRIPTION OF THE DRAWINGS

[0026] Figure 1 This is a structural schematic diagram of a first embodiment of a VR multi-platform adaptation system based on Unity engineering of the present invention;

[0027] Figure 2 for Figure 1 The working diagram of VR multi-platform adaptation system based on Unity project;

[0028] Figure 3 for Figure 1 The structural diagram of the hardware input event detection module;

[0029] Figure 4 The figure is a flow chart of a first embodiment of a VR multi-platform adaptation method based on Unity project of the present invention.

[0030] Description of labels:

[0031] 1. VR hardware platform packaging module; 2. Hardware input event detection module; 3. Interaction event response module.

[0032] The realization of the purpose, functional features and advantages of the present invention will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION

[0033] It should be understood that the specific embodiments described herein are only used to explain the present invention, and are not used to limit the present invention.

[0034] Reference Figures 1 to 3 The present invention provides a VR multi-platform adaptation system based on Unity engineering, comprising:

[0035] VR hardware platform packaging module 1 is used to package the Android permissions, metadata and Activities required by the VR software development kit and generate an Android software project;

[0036] Hardware input event detection module 2, used to detect input command information of the VR hardware platform;

[0037] The interactive event response module 3 is used to execute the instruction information input by the VR hardware platform to complete the interaction.

[0038] In the embodiment of the present invention, the VR hardware platform packaging module 1 is used to solve the inconsistency between Android permissions and metadata required by the VR software development kit and the inconsistency between Activities required to be used by the VR software development kit.

[0039] The hardware input event detection module 2 is to solve the problem that the VR software development kit detects inconsistent input events of the handle and the helmet, where the handle and the helmet are included in the VR hardware platform, and the VR hardware platform includes VR devices from manufacturers such as HTC, Pico and Skyworth. Specifically, Figure 2 As shown, the VR helmet input event and the handle input event are abstracted into two base classes. This base class is an abstract class that declares the input events for detecting VR helmets and handles. Each VR software development kit implements two subclasses that inherit the VR helmet input event abstract class and the handle input event abstract class respectively, and implements the methods declared in the abstract classes. The implementation process is to call the detection method for VR helmet and handle input events in the VR software development kit. Taking the Skyworth platform as an example, there is an update function in the hardware input event detection module 2 (this function will be executed in a loop), in which the "Enter" key is detected to see if it is pressed. In the Skyworth platform, detecting whether the "Enter" key is pressed is to detect whether the "Trigger" key is pressed. In this way, the Trigger key of the Skyworth platform is mapped to the Enter key defined in this system. The system maps the keys of each VR hardware platform with the system through the hardware input event detection module 2, and there is no need for the VR software development kit to map the keys of each VR hardware platform separately, which greatly improves efficiency. In addition, the system monitors the user's hardware input events through the hardware input event detection module 2.

[0040] The interactive event response module 3 is used to execute the command information input by the VR hardware platform to complete the interaction. It is used to solve the inconsistency of the interactive event response events of the VR software development kit. Specifically, by inheriting the BaseInputModule class of Unity's own event response system, an event processing class based on VR interaction is implemented. By obtaining unified hardware input events and hardware key events, the mouse click events in the BaseInputModule class are replaced. The position of this cursor is determined by the handle or helmet. If the handle is in a connected state, the cursor movement is controlled by moving the handle left and right, up and down; if the handle is not connected, the cursor movement is controlled by moving the head display left and right, up and down, and a custom cursor is used to replace the mouse movement on a traditional computer, so as to achieve the purpose of replacing the mouse with a handle or helmet.

[0041] In summary, the VR hardware platform packaging module 1 is used to solve the inconsistency of Android permissions and metadata required by the VR software development kit and the inconsistency of Activities required to be used by the VR software development kit; the hardware input event detection module 2 is used to solve the inconsistency of VR software development kit interaction event response events; the interaction event response module 3 is used to solve the inconsistency of VR software development kit interaction event response events, thereby completing the adaptation of the VR software development kit to various VR hardware platforms. Through this system, the VR software development kit can be developed or updated once and can be used for various VR hardware platforms. There is no need to repeatedly modify the VR software development kit for each VR hardware platform, which greatly reduces the development and maintenance costs of enterprises.

[0042] Reference Figure 4 The present invention also provides a VR multi-platform adaptation method based on Unity engineering, comprising:

[0043] S1: Obtain the current VR hardware platform information to obtain a specified VR software development kit, wherein the specified VR software development kit is a VR software development kit corresponding to the current VR hardware platform information;

[0044] S2: Hide other VR software development kits in the VR software development kit set except the specified VR software development kit;

[0045] S3: Change the AndroidManifest.xml file of the current VR hardware platform, generate an Android software project, and replace the Activity code in the Android software project according to the Activity code of the current VR hardware platform;

[0046] S4: Obtain the rotation information of the helmet or the handle, and move the cursor according to the rotation information;

[0047] S5: Obtain the command information input by the helmet or handle, and execute the operation corresponding to the command information.

[0048] In an embodiment of the present invention, the current VR hardware platform information is obtained, and the VR software development kit is packaged in the Unity project, specifically including obtaining a specified VR software development kit, hiding other VR software development kits in the VR software development kit set except the specified VR software development kit, changing the AndroidManifest.xml file of the current VR hardware platform, generating an Android software project, and replacing the Activity code in the Android software project according to the Activity code of the current VR hardware platform. After packaging is completed, a software package APK is generated. After the VR hardware platform installs the software package APK, a unified Unity interactive event response is set. Obtain the rotation information of the helmet or handle, and move the cursor according to the rotation information. Finally, the VR multi-platform adaptation system obtains the command information input by the helmet or handle, and executes the operation corresponding to the command information. In summary, the VR hardware platform packaging module 1 is used to solve the inconsistency of Android permissions and metadata required by the VR software development kit and the inconsistency of Activities required to be used by the VR software development kit; the hardware input event detection module 2 is used to solve the inconsistency of VR software development kit interaction event response events; the interaction event response module 3 is used to solve the inconsistency of VR software development kit interaction event response events, thereby completing the adaptation of the VR software development kit to various VR hardware platforms. Through this system, the VR software development kit can be developed or updated once and can be used for various VR hardware platforms. There is no need to repeatedly modify the VR software development kit for each VR hardware platform, which greatly reduces the development and maintenance costs of enterprises.

[0049] In other embodiments of the present invention, before obtaining the information of the VR hardware platform, for later interaction, a cursor required for interaction needs to be generated first. Specifically, it includes: creating a new scene, placing the pre-created objects corresponding to the current VR hardware platform into the scene, wherein the scene will be attached to the main scene when loaded; using Unity's own UI system UGUI in the scene to create an Image, and attaching a hollow circle to the texture as the cursor of the current VR hardware platform; copying the cursor to generate the first cursor and the second cursor; placing the first cursor under the object representing the helmet as the first child object, and placing the second cursor under the object representing the handle as the second child object, wherein the helmet and the handle are both included in the current VR hardware platform; for example, taking the process of data acquisition to UI (User Interface) response as an example: creating a new scene, placing the pre-created objects that need to adapt to the platform into this scene, and this scene will be attached to the main scene when loaded. For example, for the Pico platform, Pvr_UnitySDK, ControllerManager, etc. need to be placed in this scene. In this scene, use Unity's built-in UI system UGUI to create an Image, and paste a texture on a hollow circle to use it as the cursor in VR. Duplicate the cursor once, place cursor 1 under the object representing the helmet as its child object, and place cursor 2 under the object representing the handle as its child object. In Unity, the movement and rotation of the parent object will drive the same movement and rotation of the child object. For example, on the Pico platform, place cursor 1 under an object called Head as its child object. The movement of the cursor is driven by the rotation of the helmet or the movement of the handle. The rotation of the helmet or the movement of the handle is defined in the software development kit. When the cursor moves to the UI, if the Trigger key of the Pico platform is pressed at this time, the EnterClick in the input event detection module will be triggered, and the mouse click event will be executed. If this UI listens for the mouse click event, the corresponding method will be executed.

[0050] Furthermore, the AndroidManifest.xml file of the current VR hardware platform is modified to generate the step S3 of the Android software project, including:

[0051] S31: Prepare an AndroidManifest.xml file for the current VR hardware platform, and add the permissions and metadata required by the specified VR hardware platform;

[0052] S32: A Json file containing all VR hardware platform packaging data is stored in the Unity project, including the AndroidManifest.xml file, packaging registration and version information of the current VR hardware platform;

[0053] S33: Before packaging, copy the AndroidManifest.xml file to the Plugins / Android folder, add common data, and generate an Android software project.

[0054] In the embodiment of the present invention, taking the modification of the AndroidManifest.xml file of the Pico platform as an example, an AndroidManifest.xml file for the Pico platform is prepared, and some necessary permissions and metadata of the Pico platform are added; a json file of all VR hardware platform packaging data is stored in the Unity project, which contains the location of the AndroidManifest.xml file of the pico platform, the package name, the version information, etc.; before packaging, the AndroidManifest.xml file of Pico is copied to the Plugins / Android folder; some common data is added, such as using regular expressions to detect whether there is an Application string before packaging, and if not, using regular expressions to find<manifest xxxxx> Position, insert at this position<application xxxxx / > Through the above steps, the AndroidManifest.xml file of the specified VR hardware platform is modified, thereby obtaining the required permissions.

[0055] Further, step S1 of hiding other VR software development kits in the VR software development kit set except the specified VR software development kit includes:

[0056] S11: A Json file containing all VR hardware platform package data is stored in the Unity project, specifying the current VR hardware platform AndroidManifest.xml file, package registration, version information, and VR software development kit storage files;

[0057] S12: Obtain other VR hardware platform information from the Json file and hide other VR hardware platform information.

[0058] In the embodiment of the present invention, since Unity will not package the hidden issues into the project, a set of platform switching functions is created by using the hidden file function of the Mac computer to hide the VR software development kit files of the relevant unnecessary VR hardware platforms, and only retain the files of the VR software development kit of the current platform, so that the need for multiple different VR software development kits can be realized in the same project. The specific process is to store a Json file of all VR hardware platform package data in the Unity project, specify the current VR hardware platform AndroidManifest.xml file, package registration, version information and VR software development kit storage files, etc.; take out the information of the VR hardware platform that needs to be hidden and store it in a list. Call the System.Diagnostics.ProcessStart class. Set processStartInfo.Arguments = "hidden" + the storage file location of each VR software development kit that needs to be hidden, and then enable ProcessStartInfo to hide the file.

[0059] Furthermore, step S3 of replacing the Activity code in the Android software project according to the Activity code of the current VR hardware platform includes:

[0060] S3A: After generating the Android software project, regular expressions are used to

[0061] Find the first Activity tag in the AndroidManifest.xml file and copy the name attribute from it;

[0062] S3B: The current VR hardware platform stores an original MainActivity file locally, and changes the class inherited by MainActivity to the Activity class with the copied name attribute.

[0063] In the embodiment of the present invention, Huawei is taken as an example.

[0064] After generating the Android software project, regular expressions are used to

[0065] Find the first <activity android:name="com.huawei.vrlab.HVRActivity" / >, extract HVRActivity from it; store an original MainActivity file locally on the current VR hardware platform, and replace the specified string with HVRActivity; replace the MainActivity file in the Android software project with the MainActivity file replaced by the current VR hardware platform. Through the above steps, the Activity code in the Android software project is replaced.

[0066] The above description is only a preferred embodiment of the present invention, and does not limit the patent scope of the present invention. Any equivalent structure or equivalent process transformation made by using the contents of the present invention specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present invention.

Claims

1. A VR multi-platform adaptation method based on Unity engineering, characterized in that: include: Obtaining current VR hardware platform information, thereby obtaining a specified VR software development kit, wherein the specified VR software development kit is a VR software development kit corresponding to the current VR hardware platform information; Hide other VR software development kits in the VR software development kit set except the specified VR software development kit; Modify the AndroidManifest.xml file of the current VR hardware platform, generate an Android software project, and replace the Activity code in the Android software project according to the Activity code of the current VR hardware platform; Obtaining rotation information of the helmet or handle, and moving the cursor according to the rotation information; Obtain the command information input by the helmet or the handle, and execute the operation corresponding to the command information.

2. The VR multi-platform adaptation method based on Unity engineering according to claim 1, characterized in that: The step of changing the AndroidManifest.xml file of the current VR hardware platform to generate an Android software project includes: Create an AndroidManifest.xml file for the current VR hardware platform, and add the permissions and metadata required by the specified VR hardware platform; Store a Json file containing all VR hardware platform packaging data in the Unity project, which includes the AndroidManifest.xml file, packaging registration and version information of the current VR hardware platform; Before packaging, copy the AndroidManifest.xml file to the Plugins / Android folder, add common data, and generate the Android software project.

3. The VR multi-platform adaptation method based on Unity engineering according to claim 2, characterized in that: The step of hiding other VR software development kits in the VR software development kit set except the specified VR software development kit includes: A Json file containing all VR hardware platform package data is stored in the Unity project, specifying the current VR hardware platform AndroidManifest.xml file, package registration, version information, and VR software development kit storage file; The other VR hardware platform information is obtained from the Json file, and the other VR hardware platform information is hidden.

4. The VR multi-platform adaptation method based on Unity engineering according to claim 3 is characterized in that: The step of replacing the Activity code in the Android software project according to the Activity code of the current VR hardware platform includes: After generating the Android software project, regular expressions are used to Find the first Activity tag in the AndroidManifest.xml file and copy the name attribute from it; The current VR hardware platform locally stores an original MainActivity file, and modifies the class inherited by MainActivity to the Activity class with the copied name attribute.

5. A VR multi-platform adaptation system based on Unity engineering, characterized in that: The VR multi-platform adaptation method based on Unity project as described in any one of claims 1 to 4, wherein the system comprises: VR hardware platform packaging module, used to package the Android permissions, metadata and Activities required by the VR software development kit and generate an Android software project; Hardware input event detection module, used to detect input command information of VR hardware platform; The interactive event response module is used to execute the instruction information input by the VR hardware platform to complete the interaction.