Collision detection optimization method and system for virtual reality training
By generating an inertial collision box in a virtual reality scenario and performing inertial collision inspection, the problem of not considering the motion inertia of objects in the prior art is solved, the accuracy of the collision test results is improved, and the collision test application in a virtual reality scenario is enhanced.
Patent Information
- Application Number
- CN202411390171.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-08
- Publication Date
- 2025-02-14
- Estimated Expiration
- 2044-10-08
AI Technical Summary
The prior art methods used for three-dimensional object collision detection in virtual reality scenarios do not take into account the motion inertia of objects, resulting in a difference between the collision test results and the actual results, affecting the collision test application in virtual reality scenarios.
By generating an inertial collision box based on the motion inertia of the target test object and performing inertial collision inspection, the accuracy of the collision test results in virtual reality scenarios is improved. The specific steps include determining the virtual reality model and model grid information, obtaining historical velocity information for inertial prediction, generating an inertial collision box model, and performing inertial collision detection.
By considering the motion inertia of objects, the accuracy of collision test results in virtual reality scenarios is improved, and the collision test application in virtual reality scenarios is enhanced.
Smart Images

Figure CN119444979A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of collision test modeling, and more specifically, to a collision detection optimization method and system for virtual reality training. Background Art
[0002] In a virtual reality scene, three-dimensional objects usually come into contact with each other due to user interaction. In order to ensure the game user experience, the system needs to generate corresponding collision responses when detecting the collision of three-dimensional objects, giving game users a better immersive experience. Therefore, collision detection of three-dimensional objects plays a relatively important role in the normal operation of virtual games.
[0003] The conventional three-dimensional object collision detection method mainly projects the topological structure of the three-dimensional object onto a two-dimensional plane, and obtains the intersection test result of the two-dimensional plane by judging the distance and direction of the projection result on the two-dimensional plane. Then, combined with the mapping principle of three-dimensional space, the actual collision detection result of the virtual scene is obtained. This method does not perform inertial collision detection based on the object's movement inertia, which leads to differences between the collision test results and the actual results, greatly affecting the development and application of collision testing in actual virtual reality scenes. Summary of the invention
[0004] The present application provides a collision detection optimization method and system for virtual reality training, which can generate an inertial collision box based on the motion inertia of a target test object and perform inertial collision testing, thereby improving the accuracy of collision test results in a virtual reality scene.
[0005] In a first aspect, the present application provides a collision detection optimization method for virtual reality training, which can be executed by a network device, or can also be executed by a chip configured in the network device, and the present application does not limit this.
[0006] Specifically, the method includes: Starting virtual reality collision detection to determine the virtual reality model of the target object and model mesh information corresponding to the target object in the virtual reality coordinate system; Acquire the second vertex position coordinates of the virtual reality model in the two-dimensional space based on the model grid information; Acquiring historical speed information of the virtual reality model of the target, performing inertia prediction according to the historical speed information, and obtaining an inertial collision speed of the virtual reality model; generating an inertial collision box model of the virtual reality model according to the second vertex position coordinates of the target model and the inertial collision speed of the virtual reality model; A collision box model of a collision object is generated, and inertial collision detection is performed according to the inertial collision box model and the collision box model of the collision object.
[0007] In combination with the first aspect, in some implementations of the first aspect, obtaining the second vertex position coordinates of the virtual reality model in the two-dimensional space based on the model mesh information specifically includes: obtaining the first vertex position coordinates of the virtual reality model in the three-dimensional space based on the model mesh information, and performing spatial transformation on the first vertex position coordinates to obtain the second vertex position coordinates of the virtual reality model in the two-dimensional space.
[0008] In combination with the first aspect, in some implementations of the first aspect, obtaining the first vertex position coordinates of the virtual reality model in the three-dimensional space based on the model mesh information specifically includes: Get the object center coordinates of the collision object; Acquire all grid edge points of the model grid information, and determine the Euclidean distance between each grid edge point and the object center coordinate of the collision object; The mesh edge point with the smallest Euclidean distance from the object center coordinates of the collision object is used as the first vertex position coordinate of the virtual reality model in the three-dimensional space.
[0009] In combination with the first aspect, in some implementations of the first aspect, an orthogonal projection method is used to perform spatial transformation on the first vertex position coordinates to obtain second vertex position coordinates of the virtual reality model in a two-dimensional space.
[0010] In combination with the first aspect, in certain implementations of the first aspect, performing inertia prediction according to the historical speed information to obtain the inertia collision speed of the virtual reality model specifically includes: Acquire multiple historical speed vectors according to the historical speed information; An inertia prediction model is constructed for each vector dimension of the plurality of historical velocity vectors to obtain a first inertia prediction model, a second inertia prediction model and a third inertia prediction model; Determine a first inertia collision velocity component, a second inertia collision velocity component and a third inertia collision velocity component according to the first inertia prediction model, the second inertia prediction model and the third inertia prediction model, respectively, and then obtain an inertia collision velocity vector from the first inertia collision velocity component, the second inertia collision velocity component and the third inertia collision velocity component; The inertial collision velocity vector is projected to obtain the inertial collision velocity in two-dimensional directions.
[0011] In conjunction with the first aspect, in some implementations of the first aspect, generating a collision box model of the collision object specifically includes: Get the VR model of the collision object; An inertial collision box model of the collision object is generated according to the virtual reality model of the collision object, and the inertial collision box model of the collision object is used as the collision box model of the collision object.
[0012] In combination with the first aspect, in some implementations of the first aspect, the virtual reality model file of the target object is stored in OBJ format.
[0013] In a second aspect, the present application provides a collision detection optimization system for virtual reality training, including a collision test unit, wherein the collision test unit includes: A model creation module, used to start virtual reality collision detection, determine the virtual reality model of the target object and the model grid information corresponding to the target object in the virtual reality coordinate system; A model processing module, used for acquiring the position coordinates of the second vertex of the virtual reality model in the two-dimensional space based on the model grid information; A model processing module, used to obtain historical speed information of the virtual reality model of the target, perform inertia prediction according to the historical speed information, and obtain the inertial collision speed of the virtual reality model; A model processing module, used for generating an inertial collision box model of the virtual reality model according to the second vertex position coordinates of the target model and the inertial collision speed of the virtual reality model; The test execution module is used to generate a collision box model of a collision object, and perform inertial collision detection according to the inertial collision box model and the collision box model of the collision object.
[0014] In a third aspect, the present application provides a computer terminal device, comprising a memory and a processor, wherein the memory stores a code, and the processor is configured to obtain the code and execute the above-mentioned collision detection optimization method for virtual reality training.
[0015] In a fourth aspect, the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores at least one computer program, and the computer program is loaded and executed by a processor to implement the operations performed by the above-mentioned collision detection optimization method for virtual reality training.
[0016] The technical solution provided by the embodiments disclosed in this application has the following beneficial effects: The present application provides a collision detection optimization method and system for virtual reality training. First, a virtual reality model of a target object and model grid information corresponding to the target object in a virtual reality coordinate system are determined; the second vertex position coordinates of the virtual reality model in a two-dimensional space are obtained based on the model grid information; historical speed information of the virtual reality model of the target is obtained, and inertia prediction is performed according to the historical speed information to obtain the inertial collision speed of the virtual reality model; an inertial collision box model of the virtual reality model is generated according to the second vertex position coordinates of the target model and the inertial collision speed of the virtual reality model; a collision object collision box model is generated, and inertial collision detection is performed according to the inertial collision box model and the collision object collision box model, so that the inertial collision speed of the target test object can be obtained based on the historical motion speed prediction of the target test object, and an inertial collision box is generated according to the inertial collision speed and vertex position information of the target test object, and an inertial collision test is performed, so as to finally improve the accuracy of the collision test results in the virtual reality scene. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] Figure 1 is an exemplary flow chart of a collision detection optimization method for virtual reality training according to some embodiments of the present application; Figure 2 is an exemplary flow chart for determining the position coordinates of the first vertex in some embodiments of the present application; Figure 3 is an exemplary flow chart for determining the inertial collision velocity of a virtual reality model in some embodiments of the present application; Figure 4 is a schematic diagram of exemplary hardware and / or software of a crash test unit according to some embodiments of the present application; Figure 5 It is a structural schematic diagram of a computer terminal device for implementing a collision detection optimization method for virtual reality training according to some embodiments of the present application. DETAILED DESCRIPTION
[0018] The present application determines a virtual reality model of a target object and model grid information corresponding to the target object in a virtual reality coordinate system; obtains the second vertex position coordinates of the virtual reality model in a two-dimensional space based on the model grid information; obtains historical speed information of the virtual reality model of the target, performs inertial prediction based on the historical speed information, and obtains the inertial collision speed of the virtual reality model; generates an inertial collision box model of the virtual reality model based on the second vertex position coordinates of the target model and the inertial collision speed of the virtual reality model; generates a collision object collision box model, and performs inertial collision detection based on the inertial collision box model and the collision object collision box model, so that the inertial collision speed of the target test object can be obtained based on the historical motion speed prediction of the target test object, and an inertial collision box is generated and an inertial collision test is performed based on the inertial collision speed and vertex position information of the target test object, thereby ultimately improving the accuracy of the collision test results in the virtual reality scene.
[0019] In order to better understand the above technical solution, the above technical solution will be described in detail below in conjunction with the accompanying drawings and specific implementation methods. Figure 1 , which is an exemplary flow chart of a collision detection optimization method for virtual reality training according to some embodiments of the present application, and the collision detection optimization method mainly includes the following steps: In step S101, virtual reality collision detection is started to determine the virtual reality model of the target object and the model mesh information corresponding to the target object in the virtual reality coordinate system.
[0020] Optionally, in some embodiments, determining the virtual reality model of the target can be achieved by selecting or importing the target model from a 3D model library. In specific implementation, when the target model does not exist in the existing library, it is necessary to use 3D modeling software (such as Blender, Maya, etc.) to create the target model and define its geometric structure and material properties.
[0021] In some embodiments, the model mesh information corresponding to the target in the virtual reality coordinate system can be obtained by extracting the mesh information (MeshData) of the virtual reality model of the target, including the position coordinates of all vertices, connecting edges, and the sequence of vertices constituting the face. The mesh information can be directly read from the model file or generated by a graphics API (such as OpenGL, DirectX). In some embodiments, the virtual reality model file of the target object is stored in OBJ format.
[0022] In step S102, the second vertex position coordinates of the virtual reality model in the two-dimensional space are obtained based on the model mesh information.
[0023] Preferably, in some embodiments, obtaining the second vertex position coordinates of the virtual reality model in the two-dimensional space based on the model mesh information specifically includes: obtaining the first vertex position coordinates of the virtual reality model in the three-dimensional space based on the model mesh information, and performing spatial transformation on the first vertex position coordinates to obtain the second vertex position coordinates of the virtual reality model in the two-dimensional space.
[0024] Optionally, in some embodiments, reference Figure 2 As shown in FIG. 1 , this figure is an exemplary flow chart of determining the position coordinates of the first vertex in some embodiments of the present application. Acquiring the position coordinates of the first vertex of the virtual reality model in the three-dimensional space based on the model mesh information specifically includes: In step S1021, the object center coordinates of the collision object are obtained; In step S1022, all grid edge points of the model grid information are obtained, and the Euclidean distance between each grid edge point and the object center coordinate of the collision object is determined; In step S1023, the mesh edge point with the smallest Euclidean distance to the object center coordinates of the collision object is used as the first vertex position coordinates of the virtual reality model in the three-dimensional space.
[0025] It should be noted that the collision object is a virtual object used in the virtual reality space to perform collision tests on the target model. In specific implementation, the centroid of the collision object can be used as the object center of the collision object, and the coordinate value of the object center can be used as the object center coordinates of the collision object.
[0026] In some embodiments, the mesh vertices of the model mesh information can be used as mesh edge points of the model mesh information, and all vertex coordinates can be extracted from the mesh information of the target model. For example, the vertex coordinates can be represented as a vertex list V={v1,v2,…,vn}, where each vertex vi=(xi,yi,zi) is a three-dimensional vector used to represent a mesh edge point.
[0027] Optionally, in some embodiments, an orthogonal projection method is used to perform spatial transformation on the first vertex position coordinates to obtain the second vertex position coordinates of the virtual reality model in a two-dimensional space.
[0028] It should be noted that orthogonal projection is a commonly used method for directly projecting a point in three-dimensional space onto a two-dimensional plane. The perspective effect of the viewing angle is not considered during the projection process, so there is no change in distance or size.
[0029] In step S103, historical speed information of the virtual reality model of the target is obtained, and inertia prediction is performed based on the historical speed information to obtain the inertial collision speed of the virtual reality model.
[0030] Optionally, in some embodiments, the historical speed information of the target virtual reality model can be obtained by parsing the target virtual reality model file. In specific implementation, the virtual reality model file contains a portion of the speed information of the target object. In some other embodiments, a speed value sequence can also be randomly generated by a random number generator as the historical speed information of the target virtual reality model, wherein the sequence element in the speed value sequence is the speed vector of the target virtual reality model.
[0031] It should be noted that the inertial collision speed is a predicted collision speed obtained by predicting the historical speed information of the virtual reality model, which is used to extend the collision box of the virtual online model to obtain the inertial collision box for the inertial collision test. Optionally, in some embodiments, reference Figure 3 As shown in FIG. 1 , this figure is an exemplary flow chart of determining the inertial collision speed of the virtual reality model in some embodiments of the present application. The inertial prediction is performed according to the historical speed information to obtain the inertial collision speed of the virtual reality model, which specifically includes: In step S1031, a plurality of historical speed vectors are obtained according to the historical speed information; In step S1032, an inertia prediction model is constructed for each vector dimension of the plurality of historical velocity vectors to obtain a first inertia prediction model, a second inertia prediction model, and a third inertia prediction model; In step S1033, an inertial collision velocity prediction is performed according to the first inertial collision prediction model, the second inertial collision prediction model and the third inertial collision prediction model, and a first inertial collision velocity component, a second inertial collision velocity component and a third inertial collision velocity component are determined respectively, and then an inertial collision velocity vector is obtained from the first inertial collision velocity component, the second inertial collision velocity component and the third inertial collision velocity component; In step S1034, vector projection is performed on the inertial collision velocity vector to obtain the inertial collision velocity in two-dimensional directions.
[0032] Optionally, in some embodiments, a moving average autoregressive model is used as an inertia prediction model; the following is a preferred embodiment of using a moving average autoregressive model as an inertia prediction model for inertia collision velocity prediction in the present application: first, the prediction period is preset to 100 unit times. At this time, the velocity components of the first dimension of the tunnel in the past 100 unit times can be recorded separately to obtain a first dimension velocity component sequence. In other embodiments, the prediction period can also be preset to other time lengths; and then a time series graph of the first dimension velocity component sequence can be drawn, and the horizontal axis of the time series graph corresponds to the moments corresponding to different unit times. Then, the time series graph of the first dimension velocity component sequence set can be exponentially converted to eliminate the trend of variance changing over time in the time series graph.
[0033] Secondly, according to the time series diagram of the first-dimensional velocity component sequence, the autocorrelation coefficient diagram of the first-dimensional velocity component is drawn, where the horizontal axis of the autocorrelation coefficient diagram is the lag period and the vertical axis is the value of the autocorrelation coefficient. The partial autocorrelation coefficient diagram of the first-dimensional velocity component is drawn, where the horizontal axis of the partial autocorrelation coefficient diagram is the lag period and the vertical axis is the value of the partial autocorrelation coefficient.
[0034] According to the characteristics of the autocorrelation coefficient graph and the partial autocorrelation coefficient graph, the order of the model and the range of coefficient values can be preliminarily determined. For example, the autocorrelation coefficient graph can be drawn to observe whether the autocorrelation coefficient shows truncation characteristics after a certain order. If the autocorrelation coefficient drops sharply after a certain order and remains near 0, the order of the autoregressive model can be preliminarily determined; the partial autocorrelation coefficient graph can be drawn to observe whether the partial autocorrelation coefficient shows truncation characteristics after a certain order. If the partial autocorrelation coefficient drops sharply after a certain order and remains near 0, the order of the moving average model can be preliminarily determined.
[0035] In specific implementation, the last significant autocorrelation coefficient can be found according to the autocorrelation coefficient graph, which is the order of the autocorrelation model. For example, if the last significant autocorrelation coefficient in the autocorrelation coefficient graph is at the third order, the order of the autocorrelation model is 3; then, according to the partial autocorrelation coefficient graph, the last significant partial autocorrelation coefficient can be found, which is the order of the moving average model. For example, if the last significant partial autocorrelation coefficient in the partial autocorrelation coefficient graph is at the second order, the order of the moving average model is 2; finally, according to the autocorrelation coefficient graph and the partial autocorrelation coefficient graph, the order (p, q) of the autoregressive moving average model is determined. For example, if the autocorrelation coefficient graph and the partial autocorrelation coefficient graph both decay to zero after the third order, the order of the autoregressive moving average model is (3, 3); then, according to the order of the autoregressive moving average model, appropriate parameters are selected to establish the autoregressive moving average model of the first dimensional velocity component sequence, and the first dimensional velocity component sequence is brought into the autoregressive moving average model, so that the subsequent first dimensional velocity component can be predicted, wherein the first dimensional velocity component at the end of the next unit time is taken as the first inertial collision velocity component.
[0036] In specific implementation, for example, the least squares method can be used to perform parameter estimation and significance test on the model autoregressive and moving average processes. In some embodiments, the significance test level is 0.05. Finally, the most suitable autoregressive moving average model parameters are selected according to the Schwarz Bayes criterion to determine the final autoregressive moving average model of the first dimensional velocity component.
[0037] The first inertia prediction model is a function of the change of the first dimensional velocity component in the past unit time. The first dimensional velocity component sequence is brought into the autoregressive moving average model to predict the subsequent first dimensional velocity components. In some embodiments, the first dimensional velocity component at the end of the next unit time is used as the first inertia collision velocity component.
[0038] In some embodiments, an orthogonal projection method is used to perform vector projection on the inertial collision velocity vector to obtain the inertial collision velocity in two-dimensional directions.
[0039] In step S104, an inertial collision box model of the virtual reality model is generated according to the second vertex position coordinates of the target model and the inertial collision speed of the virtual reality model.
[0040] It should be noted that the inertial collision box model is an adaptive collision box model obtained based on the historical speed information of the virtual reality model. The inertial collision prediction based on the adaptive collision box model can predict the collision result during the continuous movement of the virtual reality model object. Optionally, in some embodiments, according to the second vertex position coordinates of the target model and the inertial collision speed of the virtual reality model, generating the inertial collision box model of the virtual reality model specifically includes: Obtain all edge points of the target model, and determine the model center point according to the geometric center of all edge points; Centralize all edge points of the target model according to the model center point of the target model to obtain a centralized edge point set of the target model; Obtain the covariance matrix of the target model based on the centralized edge point set; Obtaining the eigenvalues and eigenvectors of the covariance matrix, and performing feature screening on the eigenvalues and eigenvectors of the covariance matrix according to the inertial collision velocity of the virtual reality model to obtain the inertial eigenvalues and inertial eigenvectors; An inertial collision box model of the virtual reality model is generated according to the inertial eigenvalue and the inertial eigenvector, and the second vertex position coordinates of the target model.
[0041] Optionally, in some embodiments, all model vertex coordinates in the target model file may be used as edge points of the target model, and then a centralized edge point set may be obtained by performing difference operations on all edge points and the position coordinates of the geometric center.
[0042] In some embodiments, the covariance matrix of the target model is determined according to the following formula:
[0043] in, is the covariance matrix, N is the number of centralized edge points in the centralized edge point set, i is the intermediate variable for summation, is the coordinate vector of the i-th centralized edge point in the centralized edge point set, is the transposed vector of the coordinate vector of the i-th centralized edge point in the centralized edge point set.
[0044] Optionally, in some embodiments, feature screening is performed on the eigenvalues and eigenvectors of the covariance matrix according to the inertial collision velocity of the virtual reality model to obtain the inertial eigenvalues and inertial eigenvectors, specifically including: Get the velocity vector of the inertial collision velocity of the virtual reality model; According to the velocity vector of the inertial collision velocity, vector products are obtained for all the eigenvectors respectively, the eigenvector with the smallest vector product is removed, and the mean vector of the eigenvector is filled in to supplement, so as to obtain multiple inertial eigenvectors; The eigenvalue corresponding to the eigenvector with the smallest vector product is removed, and the mean of the eigenvalue is filled in to supplement it, so as to obtain multiple inertia eigenvalues.
[0045] It should be noted that when the vector product of the feature vector and the velocity vector of the inertial collision velocity is smaller, it indicates that the vector direction of the feature vector deviates more from the direction of the inertial collision velocity. At this time, it is necessary to reconstruct the feature vector to obtain the inertial feature vector, thereby increasing the distance of the final inertial collision box in the direction of the inertial collision velocity and improving the accuracy of the collision test when the target object moves in the direction of the inertial collision velocity.
[0046] Optionally, in some embodiments, generating an inertial collision box model of the virtual reality model according to the inertial eigenvalue and the inertial eigenvector, and the second vertex position coordinates of the target model specifically includes: Obtain inertia eigenvalues and inertia eigenvectors, and determine the model direction of the inertia collision box model according to the inertia eigenvalues and inertia eigenvectors; The second vertex position is used as the model center of the inertial collision box model; A local coordinate system is constructed through inertial eigenvectors, and all model vertices of the virtual reality model are converted to the local inertial coordinate system; Create an axis-aligned bounding box in the local inertial coordinate system; Transform the model vertices of the axis-aligned bounding box back to the VR coordinate space to obtain the inertial collision box model.
[0047] Preferably, in some embodiments, the transformation matrix of the local inertial coordinate system is a square matrix composed of inertial eigenvectors, and all model vertices of the virtual reality model can be transformed into the local inertial coordinate system by multiplying the inverse matrix of the transformation matrix of the local inertial coordinate system with the vertex coordinates of the virtual reality model.
[0048] Optionally, in some embodiments, existing technologies may be used to establish an axis-aligned bounding box in a local inertial coordinate system. For example, endpoint coordinates in the local inertial coordinate system are calculated, an axis-aligned bounding box is constructed based on the endpoint coordinates, and then the axis-aligned bounding box is converted back to the virtual reality coordinate space through the transformation matrix of the local inertial coordinate system to obtain an inertial collision box model.
[0049] In step S105, a collision box model of a collision object is generated, and inertial collision detection is performed according to the inertial collision box model and the collision box model of the collision object.
[0050] Preferably, in some embodiments, generating a collision box model of a collision object specifically includes: Get the VR model of the collision object; An inertial collision box model of the collision object is generated according to the virtual reality model of the collision object, and the inertial collision box model of the collision object is used as the collision box model of the collision object.
[0051] Preferably, in some embodiments, performing inertial collision detection according to the inertial collision box model and the collision object collision box model specifically includes: Get the projection coordinates of the inertial collision box model on different coordinate axes of the virtual reality space; Get the projection coordinates of the collision box model of the collision object on different coordinate axes of the virtual reality space; Determine whether there is an overlap between the projection coordinates of the inertial collision box model on different coordinate axes in the virtual reality space and the projection coordinates of the collision object collision box model on different coordinate axes in the virtual reality space. If there is an overlap, determine that there is an inertial collision between the target object and the collision object.
[0052] In addition, in another aspect of the present application, in some embodiments, the present application provides a collision detection optimization system for virtual reality training, the system comprising a collision test unit, referring to Figure 4 , which is a schematic diagram of exemplary hardware and / or software of a collision test unit according to some embodiments of the present application, the collision test unit 400 includes: a model creation module 401, a model processing module 402, and a test execution module 404, which are described as follows: The model creation module 401 is used to start virtual reality collision detection, determine the virtual reality model of the target object and the model grid information corresponding to the target object in the virtual reality coordinate system; The model processing module 402 is used to obtain the second vertex position coordinates of the virtual reality model in the two-dimensional space based on the model grid information; The model processing module 402 is used to obtain the historical speed information of the virtual reality model of the target, perform inertia prediction based on the historical speed information, and obtain the inertial collision speed of the virtual reality model; The model processing module 402 is used to generate an inertial collision box model of the virtual reality model according to the second vertex position coordinates of the target model and the inertial collision speed of the virtual reality model; The test execution module 403 is used to generate a collision box model of the collision object, and perform inertial collision detection according to the inertial collision box model and the collision box model of the collision object.
[0053] The above describes in detail an example of a collision detection optimization method and system for virtual reality training provided in an embodiment of the present application. It can be understood that in order to achieve the above functions, the corresponding device includes a hardware structure and / or software module corresponding to executing each function.
[0054] Those skilled in the art should easily realize that, in combination with the units and algorithm steps of each example described in the embodiments disclosed in this document, the present application can be implemented in the form of hardware or a combination of hardware and computer software. Whether a certain function in the application is executed in hardware or in a computer software-driven hardware manner depends on the specific application and design constraints of the technical solution. Therefore, professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0055] In addition, the present application also provides a computer terminal device, which includes a memory and a processor, the memory stores a code, and the processor is configured to obtain the code and execute the above-mentioned collision detection optimization method for virtual reality training.
[0056] In some embodiments, reference Figure 5 , which is a schematic diagram of the structure of a computer terminal device using a collision detection optimization method for virtual reality training according to some embodiments of the present application. A collision detection optimization method for virtual reality training in the above embodiment can be Figure 5 The computer terminal device 500 shown in the figure is implemented, and the computer terminal device 500 includes at least one communication bus 501, a communication interface 502, a processor 503 and a memory 504.
[0057] The processor 503 may be a general-purpose central processing unit (CPU), an application-specific integrated circuit (ASIC), or one or more processors for controlling the execution of a collision detection optimization method for virtual reality training in the present application.
[0058] The communication bus 501 may include a path for transmitting information between the above-mentioned components.
[0059] The memory 504 may be a read-only memory (ROM) or other types of static storage devices that can store static information and instructions, a random access memory (RAM) or other types of dynamic storage devices that can store information and instructions, or an electrically erasable programmable read-only memory (EEPROM), a compact disc read-only memory (CD-ROM) or other optical disc storage, an optical disc storage (including a compressed optical disc, a laser disc, an optical disc, a digital versatile disc, a Blu-ray disc, etc.), a magnetic disk or other magnetic storage device, or any other medium that can be used to carry or store the desired program code in the form of an instruction or data structure and can be accessed by a computer, but is not limited thereto. The memory 504 may exist independently and be connected to the processor 503 via the communication bus 501. The memory 504 may also be integrated with the processor 503.
[0060] The memory 504 is used to store the program code for executing the solution of the present application, and the execution is controlled by the processor 503. The processor 503 is used to execute the program code stored in the memory 504. The program code may include one or more software modules. The determination of the second vertex position coordinates in the above embodiment can be implemented by the processor 503 and one or more software modules in the program code in the memory 504.
[0061] The communication interface 502 uses any transceiver or other device for communicating with other devices or communication networks, such as Ethernet, radio access network (RAN), wireless local area networks (WLAN), etc.
[0062] Optionally, the computer terminal device 500 may further include a power supply 505 for providing power to various devices or circuits in the real-time computer terminal device.
[0063] In a specific implementation, as an embodiment, a computer terminal device may include multiple processors, each of which may be a single-CPU processor or a multi-CPU processor. The processor here may refer to one or more devices, circuits, and / or processing cores for processing data (such as computer program instructions).
[0064] The above-mentioned computer terminal device may be a general-purpose computer terminal device or a dedicated computer terminal device. In a specific implementation, the computer terminal device may be a desktop computer, a portable computer, a network server, a personal digital assistant (PDA), a mobile phone, a tablet computer, a wireless terminal device, a communication device or an embedded device. The embodiment of the present application does not limit the type of computer terminal device.
[0065] In addition, in other aspects of the present application, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores at least one computer program, and the computer program is loaded and executed by a processor to implement the operations performed by the above-mentioned collision detection optimization method for virtual reality training.
[0066] In summary, in a collision detection optimization method and system for virtual reality training disclosed in an embodiment of the present application, firstly, a virtual reality model of a target object and model grid information corresponding to the target object in a virtual reality coordinate system are determined; based on the model grid information, the second vertex position coordinates of the virtual reality model in a two-dimensional space are obtained; historical speed information of the virtual reality model of the target is obtained, and inertia prediction is performed according to the historical speed information to obtain the inertial collision speed of the virtual reality model; an inertial collision box model of the virtual reality model is generated according to the second vertex position coordinates of the target model and the inertial collision speed of the virtual reality model; a collision object collision box model is generated, and inertial collision detection is performed according to the inertial collision box model and the collision object collision box model, so that the inertial collision speed of the target test object can be obtained based on the historical motion speed prediction of the target test object, and an inertial collision box is generated according to the inertial collision speed and vertex position information of the target test object and an inertial collision test is performed, thereby finally improving the accuracy of the collision test results in the virtual reality scene.
[0067] The above is only an embodiment of the present application, and the common knowledge such as the specific technical scheme or characteristics in the scheme is not described in detail here. It should be pointed out that for those skilled in the art, without departing from the technical scheme of the present application, several modifications and improvements can be made, which should also be regarded as the scope of protection of the present application, and these will not affect the effect of the implementation of the present application and the practicality of the patent.
[0068] The scope of protection claimed by this application shall be based on the content of its claims. The specific implementation methods and other records in the specification can be used to interpret the content of the claims. Obviously, those skilled in the art can make various changes and modifications to this application without departing from the spirit and scope of the present invention. Thus, if these modifications and variations of this application fall within the scope of the claims of this application and their equivalents, this application is also intended to include these modifications and variations.
Claims
1. A collision detection optimization method for virtual reality training, characterized in that: include: Initiate virtual reality collision detection, determine the virtual reality model of the target object, and determine the model grid information corresponding to the target object in the virtual reality coordinate system; Acquire the second vertex position coordinates of the virtual reality model in the two-dimensional space based on the model grid information; Acquiring historical speed information of the virtual reality model of the target, performing inertia prediction according to the historical speed information, and obtaining an inertial collision speed of the virtual reality model; generating an inertial collision box model of the virtual reality model according to the second vertex position coordinates of the target model and the inertial collision speed of the virtual reality model; A collision box model of a collision object is generated, and inertial collision detection is performed according to the inertial collision box model and the collision object collision box model.
2. The collision detection optimization method for virtual reality training according to claim 1, characterized in that: The obtaining the second vertex position coordinates of the virtual reality model in the two-dimensional space based on the model mesh information includes: Based on the model mesh information, first vertex position coordinates of the virtual reality model in three-dimensional space are acquired, and the first vertex position coordinates are spatially transformed to acquire second vertex position coordinates of the virtual reality model in two-dimensional space.
3. The collision detection optimization method for virtual reality training according to claim 2, characterized in that: The step of obtaining the first vertex position coordinates of the virtual reality model in the three-dimensional space based on the model mesh information includes: Get the object center coordinates of the collision object; Acquire all grid edge points of the model grid information, and determine the Euclidean distance between each grid edge point and the object center coordinate of the collision object; The mesh edge point with the smallest Euclidean distance from the object center coordinates of the collision object is used as the first vertex position coordinate of the virtual reality model in the three-dimensional space.
4. The collision detection optimization method for virtual reality training according to claim 2, characterized in that: The method further comprises: The first vertex position coordinates are spatially transformed by using an orthogonal projection method to obtain the second vertex position coordinates of the virtual reality model in a two-dimensional space.
5. The collision detection optimization method for virtual reality training according to claim 1, characterized in that: The inertia prediction is performed according to the historical speed information to obtain the inertia collision speed of the virtual reality model, including: Acquire multiple historical speed vectors according to the historical speed information; Constructing an inertia prediction model for each vector dimension of the plurality of historical velocity vectors respectively, to obtain a first inertia prediction model, a second inertia prediction model and a third inertia prediction model; Determine a first inertia collision velocity component, a second inertia collision velocity component, and a third inertia collision velocity component according to the first inertia prediction model, the second inertia prediction model, and the third inertia prediction model, respectively, and obtain an inertia collision velocity vector according to the first inertia collision velocity component, the second inertia collision velocity component, and the third inertia collision velocity component; The inertial collision velocity vector is projected to obtain the inertial collision velocity in two-dimensional directions.
6. The collision detection optimization method for virtual reality training according to claim 1, characterized in that: The generating of the collision box model of the collision object comprises: Get the VR model of the collision object; An inertial collision box model of the collision object is generated according to the virtual reality model of the collision object, and the inertial collision box model of the collision object is used as the collision box model of the collision object.
7. The collision detection optimization method for virtual reality training according to claim 1, characterized in that: The virtual reality model file of the target object is stored in OBJ format.
8. A collision detection optimization system for virtual reality training, comprising a collision test unit, characterized in that: The collision test unit comprises: A model creation module, used to start virtual reality collision detection, determine the virtual reality model of the target object and the model grid information corresponding to the target object in the virtual reality coordinate system; A model processing module, used for acquiring the position coordinates of the second vertex of the virtual reality model in the two-dimensional space based on the model grid information; A model processing module, used to obtain historical speed information of the virtual reality model of the target, perform inertia prediction according to the historical speed information, and obtain the inertial collision speed of the virtual reality model; A model processing module, used for generating an inertial collision box model of the virtual reality model according to the second vertex position coordinates of the target model and the inertial collision speed of the virtual reality model; The test execution module is used to generate a collision box model of a collision object, and perform inertial collision detection according to the inertial collision box model and the collision box model of the collision object.
9. A computer terminal device, characterized in that: The computer terminal device includes a memory and a processor, the memory stores codes, and the processor is configured to obtain the codes and execute a collision detection optimization method for virtual reality training according to any one of claims 1 to 7.
10. A computer-readable storage medium storing at least one computer program, characterized in that: The computer program is loaded and executed by a processor to implement the operations performed by the collision detection optimization method for virtual reality training as described in any one of claims 1 to 7.
Citation Information
Patent Citations
Medical vehicle anti-collision detection method, device and system
CN110806581A
Game control method and device, electronic equipment and storage medium
CN112807681A
Moving target trajectory prediction method and device based on visual transformation
CN114419098A
Collision detection method and device based on virtual reality, electronic equipment and medium
CN115470568A
Simulation data generation method and device of inertial measurement equipment, medium and equipment
CN116305994A