Multi-person collaborative interactive control method, device, electronic device and storage medium
By constructing a real-time bounding box parallel to the line of sight and planning an avoidance path, the collision problem of virtual characters in multi-person collaborative interaction scenarios is solved, and the realism and interactive fluency of the virtual environment are improved.
Patent Information
- Application Number
- CN202410794065.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-19
- Publication Date
- 2025-10-03
- Estimated Expiration
- 2044-06-19
AI Technical Summary
In multi-person collaborative interaction scenarios, collisions between virtual characters lead to unnatural behaviors and experiences, affecting the realism and interactive fluency of the virtual environment.
By obtaining the virtual model's direction of travel and constructing a real-time bounding box parallel to the line of sight, potential collisions are determined and an avoidance path is planned to ensure that the virtual model avoids the collision point.
It improves the interactive fluidity and realism of the virtual environment and enhances the user experience.
Smart Images

Figure CN118521644B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of data processing, and in particular to a multi-person collaborative interaction control method, device, electronic device, and storage medium. Background Art
[0002] With the development of avatar technology, this technology has shown tremendous potential in a variety of fields, including entertainment, education, and healthcare. Through avatars, users can enjoy more realistic and interactive gaming experiences and participate in unprecedented immersive entertainment activities. In education, avatars serve as teaching aids, vividly demonstrating complex concepts and processes, making learning more interesting and effective. These innovative applications not only enhance the user experience but also promote technological progress and development in various fields.
[0003] Multiplayer collaborative interaction is a key application scenario in virtual reality. Effectively controlling multiple virtual models, avoiding collisions between them, and improving the fluidity and realism of interaction have long been pressing challenges in this field. Because the behavior of virtual characters is controlled by computer programs, collisions can occur in busy scenes, leading to unnatural behavior and experiences. For example, when two virtual characters pass through each other, intersecting images can result, significantly reducing the realism and immersion of the virtual environment.
[0004] This uncoordinated collision not only destroys the user's immersive experience, but also may affect the execution of tasks and the smoothness of interaction in the virtual environment. Therefore, a method is needed to solve the problem of virtual character collision in multi-person collaborative interaction scenarios. Summary of the Invention
[0005] The present application provides a multi-person collaborative interaction control method, device, electronic device and storage medium, which can solve the problem of virtual character collision in multi-person collaborative interaction scenarios.
[0006] In a first aspect of the present application, a multi-person collaborative interaction control method is provided, the method comprising:
[0007] respectively obtaining the traveling directions of the multiple virtual models;
[0008] Based on the traveling direction, constructing a real-time bounding box of the virtual model, wherein multiple sides of the real-time bounding box are parallel to the line of sight of the virtual model;
[0009] Determining whether a plurality of virtual models will collide based on the real-time bounding box and the position data of the virtual models;
[0010] If it is determined that a plurality of the virtual models will collide, avoidance paths of the virtual models are planned based on the real-time positions of the virtual models.
[0011] By employing this technical solution, the movement direction and position data of multiple virtual models are acquired in real time, and a real-time bounding box parallel to the line of sight is constructed to accurately determine potential collisions. When a potential collision is detected, a path planning algorithm is used to plan an avoidance path based on the real-time position of the virtual models, ensuring that the virtual models avoid the collision point. This effectively avoids collisions and improves the fluidity and realism of virtual environment interactions.
[0012] Optionally, constructing a real-time bounding box of the virtual model based on the traveling direction specifically includes:
[0013] Obtaining the virtual center point of the virtual model;
[0014] Constructing a three-dimensional model coordinate system with the virtual center point as the origin and the moving direction as any one of a plurality of coordinate axis directions;
[0015] Determining model blocks of the virtual model in the directions of each of the coordinate axes, wherein the model blocks are models obtained by segmenting the virtual model;
[0016] Calculating the target edge points of the model block in each of the coordinate axis directions respectively;
[0017] The real-time bounding box is constructed, wherein the target edge point is located on a side of the real-time bounding box.
[0018] By employing this technical solution, the virtual center point and direction of travel of the virtual model are accurately acquired, and a 3D model coordinate system aligned with this direction is constructed. The virtual model is then segmented and the target edge points in each direction are calculated, resulting in a precise real-time bounding box. This real-time bounding box tightly encloses the virtual model and accurately reflects its dynamic changes, thereby improving the accuracy and timeliness of collision detection, effectively preventing collisions between virtual characters in multi-person collaborative interaction scenarios, and enhancing the realism and interactive experience of the virtual environment.
[0019] Optionally, determining the model blocks of the virtual model in the directions of the respective coordinate axes specifically includes:
[0020] Determine a first model block in a first travel axis direction, where the first travel axis direction is the same as the travel direction, and the first model block includes a hand model and a leg model of the virtual model;
[0021] determining a second model block in a second travel axis direction, the second travel axis direction being opposite to the travel direction, the second model block including a foot model and an arm model of the virtual model;
[0022] Determine a first side model block in a first horizontal axis direction, where the first horizontal axis direction is perpendicular to the traveling direction and parallel to a preset horizontal plane, the first side model block including a left arm model;
[0023] Determine a second side model block in a second horizontal axis direction, wherein the second horizontal axis direction is perpendicular to the traveling direction and parallel to the preset horizontal plane, the second horizontal axis direction is opposite to the first horizontal axis direction, and the second side model block includes a right arm model;
[0024] Determining a first top model block in a first vertical axis direction, wherein the first vertical axis direction is perpendicular to the traveling direction and perpendicular to the preset horizontal plane, the first top model block including a head model;
[0025] A second top model block in a second vertical axis direction is determined, wherein the second vertical axis direction is perpendicular to the traveling direction and perpendicular to the preset horizontal plane, the second vertical axis direction is opposite to the first vertical axis direction, and the second top model block includes a foot model.
[0026] By employing this technical solution, the virtual model is divided into multiple model blocks based on the direction of travel, horizontal axis, and vertical axis. These blocks include models of hands, legs, feet, arms, left arm, right arm, and head, allowing for precise location of the model's edge points along each coordinate axis. This block division and segmentation method enables more accurate construction of real-time bounding boxes, which dynamically reflect the spatial occupancy of each part of the virtual model during movement. This improves the accuracy and reliability of subsequent collision detection, avoids collisions between virtual characters in multi-person collaborative interaction scenarios, and enhances the realism and interactive experience of the virtual environment.
[0027] Optionally, respectively calculating the target edge points of the model block in each of the coordinate axis directions specifically includes:
[0028] Determine a first model point and a second model point in a first coordinate axis direction, where the first model point and the second model point are any two model points on a first model block, and the first coordinate axis direction is any one of a plurality of coordinate axis directions;
[0029] Determine a first projection point of the first model point in the direction of the first coordinate axis, and a second projection point of the second model point in the direction of the first coordinate axis;
[0030] Calculating a first distance from the first projection point to the virtual center point, and a second distance from the second projection point to the virtual center point;
[0031] If it is determined that the first distance is greater than the second distance, the first model point is determined to be the target edge point.
[0032] By employing this technical solution, the projected distances between the edge points of the virtual model along different coordinate axes are calculated, accurately determining the target edge points of each model block in each direction. This method ensures that the actual spatial occupancy of the virtual model is dynamically reflected when constructing a real-time bounding box, improving the accuracy and tightness of the bounding box. This enables more precise collision detection and avoidance path planning in multi-user collaborative interaction scenarios, enhancing the realism of the virtual environment and the user experience.
[0033] Optionally, respectively calculating the target edge points of the model block in each of the coordinate axis directions further includes:
[0034] Determine a first model block and a second model block in a second coordinate axis direction, where the second coordinate axis direction is any one of the plurality of coordinate axis directions;
[0035] determining a first edge point of the first model block and a second edge point of the second model block;
[0036] Determine a third projection point of the first edge point in the direction of the second coordinate axis, and a fourth projection point of the second edge point in the direction of the second coordinate axis;
[0037] Calculating a third distance from the third projection point to the virtual center point and a fourth distance from the fourth projection point to the virtual center point;
[0038] If it is determined that the third distance is greater than the fourth distance, the first edge point is determined to be the target edge point.
[0039] By employing this technical solution, the edge points of each model block along a coordinate axis are determined, the projections of these edge points along that axis are calculated, and the distances from the projections to the virtual center point are compared. This allows the target edge points of multiple model blocks along a particular coordinate axis to be accurately determined. This method dynamically adjusts and optimizes the bounding box boundaries along each coordinate axis, improving the accuracy and compactness of bounding box construction.
[0040] Optionally, the determining whether a plurality of virtual models will collide based on the real-time bounding box and the position data of the virtual models specifically includes:
[0041] Acquire a first bounding box of a first virtual model at multiple different moments and a second bounding box of a second virtual model at multiple different moments within a preset time period, where the first virtual model and the second virtual model are any two virtual models from the multiple virtual models;
[0042] determining a first volume of each of the first bounding boxes and a second volume of each of the second bounding boxes;
[0043] Sort the plurality of first volumes according to volume values in ascending order to obtain a first sorting result, and sort the plurality of second volumes according to volume values in ascending order to obtain a second sorting result;
[0044] Determine a first volume with the largest volume value according to the first sorting result, and determine a first bounding box corresponding to the first volume with the largest volume value as a first target bounding box; determine a second volume with the largest volume value according to the second sorting result, and determine a second bounding box corresponding to the second volume with the largest volume value as a second target bounding box;
[0045] After calculating the preset time period, the first target bounding box is at a first position at a plurality of different moments, and the second target bounding box is at a second position at a plurality of different moments;
[0046] According to the first position and the second position at the same moment, it is determined whether the first target bounding box and the second target bounding box overlap, thereby determining whether the first virtual model and the second virtual model collide.
[0047] By employing this technical solution, real-time bounding box data is acquired at multiple moments within a preset time period. The volumes of each bounding box are calculated and sorted, and the largest bounding box is identified as the target bounding box. Its position at multiple moments is then calculated to determine whether the target bounding boxes overlap, thereby determining whether virtual models will collide. By analyzing the most representative bounding boxes within a time period, this method improves the accuracy of collision detection, effectively avoids collisions between virtual models, and enhances the user experience and realism of the virtual environment in multi-person collaborative interaction scenarios.
[0048] Optionally, planning an avoidance path for the virtual model based on the real-time position of the virtual model specifically includes:
[0049] Get the collision point position of the collision point;
[0050] Calculating a collision distance between the real-time position and the collision point position;
[0051] determining an adjustment distance according to the collision distance;
[0052] calculating an adjusted speed of the virtual model based on the collision distance, the adjusted distance, and the current speed of the virtual model;
[0053] An adjustment path of the virtual model is planned according to the adjustment speed.
[0054] By employing this technical solution, the virtual model's avoidance path is planned by acquiring the collision point location, calculating the distance between the real-time location and the collision point, determining the adjusted distance, and then calculating the adjusted speed based on the collision distance, the adjusted distance, and the virtual model's current speed. This method dynamically responds to changes in the virtual model's real-time position and speed. When a potential collision is detected, it quickly adjusts the virtual model's motion path and speed to effectively avoid collisions, ensuring smoothness and safety in multi-person collaborative interaction scenarios, and enhancing the user experience and the realism of the virtual environment.
[0055] In a second aspect of the present application, a multi-person collaborative interaction control device is provided, the device comprising an acquisition module, a construction module, a judgment module, and a processing module, wherein:
[0056] The acquisition module is used to respectively acquire the moving directions of the multiple virtual models;
[0057] The construction module is configured to construct a real-time bounding box of the virtual model based on the traveling direction, wherein multiple sides of the real-time bounding box are parallel to the line of sight of the virtual model;
[0058] The judging module is configured to judge whether a plurality of virtual models will collide based on the real-time bounding box and the position data of the virtual models;
[0059] The processing module is configured to plan an avoidance path for the virtual models based on the real-time positions of the virtual models if it is determined that the multiple virtual models will collide.
[0060] Optionally, the acquisition module is used to acquire a virtual center point of the virtual model;
[0061] The construction module is configured to construct a three-dimensional model coordinate system with the virtual center point as the origin and the moving direction as any one of a plurality of coordinate axis directions;
[0062] The judgment module is used to determine the model blocks of the virtual model in the directions of the respective coordinate axes, wherein the model blocks are the models obtained by segmenting the virtual model;
[0063] The processing module is used to calculate the target edge points of the model block in each of the coordinate axis directions respectively;
[0064] The construction module is used to construct the real-time bounding box, wherein the target edge point is located on a side of the real-time bounding box.
[0065] Optionally, the judgment module is configured to determine a first model block in a first travel axis direction, where the first travel axis direction is the same as the travel direction, and the first model block includes a hand model and a leg model of the virtual model;
[0066] The judgment module is configured to determine a second model block in a second travel axis direction, the second travel axis direction being opposite to the travel direction, the second model block including a foot model and an arm model of the virtual model;
[0067] The judgment module is used to determine a first side model block in a first horizontal axis direction, where the first horizontal axis direction is perpendicular to the traveling direction and parallel to a preset horizontal plane, and the first side model block includes a left arm model;
[0068] The judgment module is used to determine a second side model block in a second horizontal axis direction, where the second horizontal axis direction is perpendicular to the travel direction and parallel to the preset horizontal plane, the second horizontal axis direction is opposite to the first horizontal axis direction, and the second side model block includes a right arm model;
[0069] The judgment module is configured to determine a first top model block in a first vertical axis direction, wherein the first vertical axis direction is perpendicular to the traveling direction and perpendicular to the preset horizontal plane, and the first top model block includes a head model;
[0070] The judgment module is used to determine a second top model block in a second vertical axis direction, where the second vertical axis direction is perpendicular to the travel direction and perpendicular to the preset horizontal plane, the second vertical axis direction is opposite to the first vertical axis direction, and the second top model block includes a foot model.
[0071] Optionally, the judgment module is used to determine a first model point and a second model point in a first coordinate axis direction, where the first model point and the second model point are any two model points on the first model block, and the first coordinate axis direction is any one of the plurality of coordinate axis directions;
[0072] The judgment module is configured to determine a first projection point of the first model point in the direction of the first coordinate axis, and a second projection point of the second model point in the direction of the first coordinate axis;
[0073] The processing module is configured to calculate a first distance from the first projection point to the virtual center point, and a second distance from the second projection point to the virtual center point;
[0074] The judgment module is configured to determine that the first model point is the target edge point if it is determined that the first distance is greater than the second distance.
[0075] Optionally, the judgment module is used to determine the first model block and the second model block in a second coordinate axis direction, where the second coordinate axis direction is any one of the plurality of coordinate axis directions;
[0076] The judgment module is used to determine a first edge point of the first model block and a second edge point of the second model block;
[0077] The judgment module is used to determine a third projection point of the first edge point in the direction of the second coordinate axis, and a fourth projection point of the second edge point in the direction of the second coordinate axis;
[0078] The processing module is configured to calculate a third distance from the third projection point to the virtual center point, and a fourth distance from the fourth projection point to the virtual center point;
[0079] The judgment module is configured to determine that the first edge point is the target edge point if it is determined that the third distance is greater than the fourth distance.
[0080] Optionally, the acquisition module is configured to acquire a first bounding box of the first virtual model at multiple different moments and a second bounding box of the second virtual model at multiple different moments within a preset time period, where the first virtual model and the second virtual model are any two virtual models among the multiple virtual models;
[0081] The judgment module is configured to determine a first volume of each of the first bounding boxes and a second volume of each of the second bounding boxes;
[0082] The processing module is configured to sort the plurality of first volumes according to volume values in ascending order to obtain a first sorting result, and sort the plurality of second volumes according to volume values in ascending order to obtain a second sorting result;
[0083] The judgment module is configured to determine a first volume with the largest volume value based on the first sorting result, and determine a first bounding box corresponding to the first volume with the largest volume value as a first target bounding box; determine a second volume with the largest volume value based on the second sorting result, and determine a second bounding box corresponding to the second volume with the largest volume value as a second target bounding box;
[0084] The processing module is configured to calculate, after a preset time period, first positions of the first target bounding box at a plurality of different moments and second positions of the second target bounding box at a plurality of different moments;
[0085] The judgment module is configured to judge whether the first target bounding box and the second target bounding box overlap based on the first position and the second position at the same time, thereby determining whether the first virtual model and the second virtual model collide.
[0086] Optionally, the acquisition module is used to acquire the collision point position of the collision point;
[0087] The processing module is used to calculate the collision distance between the real-time position and the collision point position;
[0088] The processing module is configured to determine an adjustment distance according to the collision distance;
[0089] The processing module is configured to calculate an adjusted speed of the virtual model based on the collision distance, the adjusted distance, and the current speed of the virtual model;
[0090] The processing module is used to plan an adjustment path of the virtual model according to the adjustment speed.
[0091] In the third aspect of the present application, an electronic device is provided, including a processor, a memory, a user interface and a network interface, the memory is used to store instructions, the user interface and the network interface are both used to communicate with other devices, and the processor is used to execute the instructions stored in the memory so that the electronic device performs any of the methods described above.
[0092] In a fourth aspect of the present application, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores instructions. When the instructions are executed, any one of the methods described above is executed.
[0093] In summary, one or more technical solutions provided in the embodiments of the present application have at least the following technical effects or advantages:
[0094] The system acquires the direction and position data of multiple virtual models in real time, constructing a real-time bounding box parallel to the line of sight to accurately determine potential collisions. When a potential collision is detected, a path planning algorithm is used to plan an avoidance path based on the real-time position of the virtual models, ensuring they avoid the collision point. This effectively avoids collisions and improves the fluidity and realism of virtual environment interactions. BRIEF DESCRIPTION OF THE DRAWINGS
[0095] Figure 1 This is a flowchart of a multi-person collaborative interaction control method disclosed in an embodiment of the present application;
[0096] Figure 2 is a schematic diagram of a bounding box of a virtual character model disclosed in an embodiment of the present application;
[0097] Figure 3 is a schematic diagram of a model vertex of a virtual model disclosed in an embodiment of the present application;
[0098] Figure 4 is a schematic diagram of a model coordinate system disclosed in an embodiment of the present application;
[0099] Figure 5 It is a schematic diagram of a model block in the coordinate axis direction disclosed in an embodiment of the present application;
[0100] Figure 6 is a top view schematic diagram of the overlapping movement of bounding boxes disclosed in an embodiment of the present application;
[0101] Figure 7 is a schematic diagram of a bounding box in a preset coordinate system disclosed in an embodiment of the present application;
[0102] Figure 8 This is a module diagram of a multi-person collaborative interactive control device disclosed in an embodiment of the present application;
[0103] Figure 9 This is a schematic structural diagram of an electronic device disclosed in an embodiment of the present application.
[0104] Explanation of the accompanying drawings: 801, acquisition module; 802, construction module; 803, judgment module; 804, processing module; 901, processor; 902, communication bus; 903, user interface; 904, network interface; 905, memory. DETAILED DESCRIPTION
[0105] In order to enable those skilled in the art to better understand the technical solutions in this specification, the technical solutions in the embodiments of this specification will be clearly and completely described below in conjunction with the drawings in the embodiments of this specification. Obviously, the described embodiments are only part of the embodiments of this application, not all of the embodiments.
[0106] In the description of the embodiments of this application, words such as "for example" or "for instance" are used to indicate examples, illustrations, or explanations. Any embodiment or design described as "for example" or "for instance" in the embodiments of this application should not be construed as being preferred or advantageous over other embodiments or designs. Rather, the use of words such as "for example" or "for instance" is intended to present the relevant concepts in a concrete manner.
[0107] In the description of the embodiments of the present application, the term "multiple" means two or more. For example, multiple systems refer to two or more systems, and multiple screen terminals refer to two or more screen terminals. In addition, the terms "first" and "second" are used for descriptive purposes only and are not to be understood as indicating or implying relative importance or implicitly indicating the indicated technical features. Thus, the features defined as "first" and "second" may explicitly or implicitly include one or more of the features. The terms "including", "comprising", "having" and their variations all mean "including but not limited to", unless otherwise specifically emphasized.
[0108] While avatar technology demonstrates tremendous potential in entertainment, education, healthcare, and other fields, enabling users to enjoy realistic interactive experiences, the issue of avatar collisions in multi-person collaborative interactions remains a pressing issue. Avatar behavior is controlled by computer programs, and collisions can occur in busy environments, leading to unnatural behavior and experiences, disrupting immersion, and affecting task execution and interaction fluidity. Therefore, addressing avatar collisions in multi-person collaborative interactions is crucial to enhancing the realism of virtual environments and user satisfaction.
[0109] This embodiment discloses a multi-person collaborative interaction control method. Figure 1 , including the following steps:
[0110] S110 , respectively obtaining the moving directions of the multiple virtual models.
[0111] The embodiment of the present application discloses a multi-person collaborative interactive control method applied to a server. The server includes but is not limited to electronic devices such as mobile phones, tablet computers, wearable devices, and PCs (personal computers), and can also be a background server running a multi-person collaborative interactive control method. The server can be implemented as a standalone server or a server cluster consisting of multiple servers.
[0112] A virtual model is a virtual character model (hereinafter referred to as "virtual model" and "virtual character model" refer to the same feature). When a user manipulates the virtual model, the current position and previous position of each virtual model are obtained. The following describes how to determine the direction of movement using any virtual model A among multiple virtual models:
[0113] Record the coordinates of virtual model A in the current time frame (x t ,y t , z t ), and record the coordinates of the virtual model A in the previous time frame (x t-1 ,y t-1 , z t-1The position change is obtained by calculating the difference between the current position and the previous position: Δx = x t −x t−1 ; Δy=y t −y t−1 ; Δz=z t −z t−1 .
[0114] Normalize the position change vector to obtain the unit direction vector. First, calculate the vector modulus (length), as follows:
[0115] ;
[0116] Then normalize the vector as follows:
[0117] ;
[0118] The normalized vector d is the direction of movement of the virtual character and can be used for subsequent collision detection.
[0119] S120: Construct a real-time bounding box of the virtual model based on the moving direction.
[0120] The embodiment of the present application discloses a method for constructing a virtual bounding box in real time based on a collision detection scenario. Figure 2 In computer graphics and game development, a character's bounding box is a rectangular box used to describe the spatial extent of an object in three-dimensional space. This box is typically defined by the object's minimum and maximum coordinates in three-dimensional space and can be used for various purposes, including collision detection, physics calculations, and rendering optimization.
[0121] Currently, constructing the bounding box of a virtual character model typically requires reading all vertex data from a 3D model file. This vertex data contains the 3D coordinates of each vertex in the model. By traversing all vertices, the maximum and minimum values of the model along the three coordinate axes (X, Y, and Z) are found. These extreme points define the outer boundaries of the model. Based on the calculated extreme points, the size and position of the bounding box are determined. An axis-aligned bounding box is commonly used, with sides parallel to the coordinate axes. The vertices of the bounding box are defined by their maximum and minimum coordinate values. This process is complex, requiring multiple traversals of all model vertices and calculation of the extreme points for each construction. In particular, if a bounding box has six faces, six extreme points must be calculated. This computationally intensive process results in a low efficiency in the bounding box construction process.
[0122] In one possible implementation, a real-time bounding box of a virtual model is constructed based on the direction of travel, specifically including: obtaining a virtual center point of the virtual model; constructing a three-dimensional model coordinate system with the virtual center point as the origin and the direction of travel as any one of a plurality of coordinate axis directions; determining model blocks of the virtual model in each coordinate axis direction, where the model blocks are models obtained by segmenting the virtual model; respectively calculating target edge points of the model blocks in each coordinate axis direction; and constructing a real-time bounding box, where the target edge points are located on the sides of the real-time bounding box.
[0123] Specifically, the center point of the virtual model (also called the center of mass or geometric center) is first calculated. It is usually the equilibrium point of the model geometry and can be determined by calculating the average coordinates of all model vertices. Figure 3 The model vertices of the virtual model at least include the model point at the center of the virtual character model's head, the model point at the inner center of the virtual character model's feet, the model point at the center of the virtual character's left shoulder, and the model point at the center of the virtual character's right shoulder, and respectively obtain model vertex a, model vertex b, model vertex c, and model vertex d.
[0124] Assume that the character model consists of n vertices, each of which has a three-dimensional coordinate (x i ,y i , z i ), where i = 1, 2, 3, ..., n. Then calculate the sum of the x, y, and z coordinates of all model vertices and find the average value to obtain the coordinates of the center point of the virtual model (x c ,y c , z c ):
[0125] ;
[0126] Next, refer to Figure 4 , constructing a three-dimensional model coordinate system with the virtual center point as the origin and the direction of travel as any one of multiple coordinate axes. The direction of travel can be the X-axis, the Y-axis, or the Z-axis. Then, determine the model block of the virtual model that is farthest from the virtual center point in each coordinate axis direction.
[0127] In a possible implementation, determining the model blocks of the virtual model in each coordinate axis direction specifically includes: determining a first model block in a first travel axis direction, the first travel axis direction is the same as the travel direction, the first model block includes a hand model and a leg model of the virtual model, and the first travel axis direction is the same as the travel direction; determining a second model block in a second travel axis direction, the second travel axis direction is opposite to the travel direction, the second model block includes a foot model and an arm model of the virtual model; determining a first side model block in a first horizontal axis direction, the first horizontal axis direction is perpendicular to the travel direction and parallel to a preset horizontal plane, the first side model block includes Left arm model; determine the second side model block in the second horizontal axis direction, the second horizontal axis direction is perpendicular to the traveling direction and parallel to the preset horizontal plane, the second horizontal axis direction is opposite to the first horizontal axis direction, and the second side model block includes the right arm model; determine the first top model block in the first vertical axis direction, the first vertical axis direction is perpendicular to the traveling direction and perpendicular to the preset horizontal plane, and the first top model block includes the head model; determine the second top model block in the second vertical axis direction, the second vertical axis direction is perpendicular to the traveling direction and perpendicular to the preset horizontal plane, the second vertical axis direction is opposite to the first vertical axis direction, and the second top model block includes the foot model.
[0128] Specifically, the avatar model is first divided into multiple model blocks based on joints, including the head model block, torso model block, arm model block, hand model block, leg model block, and foot model block. In practice, when the avatar model is running, the model block farthest from the center point is determined, followed by the model point on that model block farthest from the center point. Finally, a bounding box is constructed based on this model point. This eliminates the need to traverse all the model vertices and calculate the point farthest from the model center each time, reducing the computational effort required to construct the bounding box.
[0129] Reference Figure 4 First, different coordinate axis directions are determined, including a first travel axis direction, a second travel axis direction, a first horizontal axis direction, a second horizontal axis direction, a first vertical axis direction, and a second vertical axis direction. The first travel axis direction is the same as the travel direction of the avatar model and is parallel to a preset horizontal plane (the horizontal ground on which the avatar model stands, the preset horizontal plane being parallel to the travel direction of the avatar model), while the second travel axis direction is opposite to the first travel axis direction. The first horizontal axis direction is perpendicular to both the first travel axis direction and the second travel axis direction, and the first horizontal axis is parallel to the preset horizontal plane, while the second horizontal axis direction is opposite to the second horizontal axis direction. The first vertical axis direction is perpendicular to the first travel axis direction, the second travel axis direction, the first horizontal axis direction, and the second horizontal axis direction, and the first vertical axis direction is perpendicular to the preset horizontal plane. The second vertical axis direction is opposite to the first vertical axis direction.
[0130] Reference Figure 5 , according to the actual running process of the virtual character model, the area that may be farthest from the virtual center point is used as the model block in the corresponding coordinate axis direction. Specifically, for the first travel axis direction, the first model block farthest from the virtual center point may be the hand model and the leg model; for the second travel axis direction, the second model block farthest from the virtual center point may be the foot model and the arm model (including the hand model); for the first horizontal axis direction, since it is parallel to the face of the virtual character model, the first side model block farthest from the virtual center point may be the left arm model or the right arm model; for the second horizontal axis direction, the second side model block farthest from the virtual center point may be the left arm model or the right arm model; for the first vertical axis direction, the first top model block farthest from the virtual center point is the head model; for the second vertical axis direction, the second top model block farthest from the virtual center point is the foot model.
[0131] Then, based on the determined model block, the target edge points in each coordinate axis direction are calculated. The target edge points are the model points farthest from the virtual center point. The target edge points are used to construct the bounding box.
[0132] In one possible implementation, a first model point and a second model point in the direction of a first coordinate axis are determined, where the first model point and the second model point are any two model points on the first model block, and the first coordinate axis direction is any one of a plurality of coordinate axis directions; a first projection point of the first model point in the direction of the first coordinate axis and a second projection point of the second model point in the direction of the first coordinate axis are determined; a first distance from the first projection point to the virtual center point and a second distance from the second projection point to the virtual center point are calculated; if it is determined that the first distance is greater than the second distance, the first model point is determined to be a target edge point.
[0133] Specifically, for a particular coordinate axis, there may be only one model block in that coordinate axis. For example, the model block in the first vertical coordinate axis may only contain a head model. To determine the target edge point in that coordinate axis, we only need to traverse the model point in the model block in that coordinate axis that is farthest from the virtual center point.
[0134] Assume that the virtual center point coordinates of the virtual character model are (x c ,y c , z c ), for any model point (x i ,y i , z i ), the projection in the direction of a certain coordinate axis, for example, the projection point on the X axis is (x i ,y c , z c )
[0135] For any one of the multiple coordinate axis directions (the first coordinate axis direction), there is only one model block, namely the first model block. In the first model block, there are any two model points, namely the first model point with coordinates (x1, y1, z1) and the second model point with coordinates (x2, y2, z2).
[0136] Perform orthographic projection on the first model point and the second model point respectively, with the projection light perpendicular to the first coordinate axis, so as to determine the first projection point of the first model point in the direction of the first axis of travel and the second projection point of the second model point in the direction of the first axis of travel. Assuming that the first axis of travel is the X axis, the coordinates of the first projection point are (x1, y c , z c ), the coordinates of the second projection point are (x2, y c , z c ). Then calculate the first distance from the first projection point to the virtual center point, and the second distance from the second projection point to the virtual center point, as follows:
[0137] ;
[0138] Wherein, D1 is the first distance, and D2 is the second distance.
[0139] Compare the first distance and the second distance. If D1>D2, the first model point is the target edge point. If D1=D2, the first model point or the second model point is the target edge point. If D1<D2, the second model point is the target edge point.
[0140] In a possible implementation, the target edge points of the model blocks in each coordinate axis direction are calculated respectively, which specifically also includes: determining the first model block and the second model block in the second coordinate axis direction, where the second coordinate axis direction is any one of the multiple coordinate axis directions; determining the first edge point of the first model block, and the second edge point of the second model block; determining the third projection point of the first edge point in the second coordinate axis direction, and the fourth projection point of the second edge point in the second coordinate axis direction; calculating the third distance from the third projection point to the virtual center point, and the fourth distance from the fourth projection point to the virtual center point; if it is determined that the third distance is greater than the fourth distance, determining the first edge point as the target edge point.
[0141] Specifically, for a certain coordinate axis direction, there may be at least two model blocks in that coordinate axis direction. For example, the model blocks in the first travel axis direction include a hand model and a leg model. When determining the target edge point in that coordinate axis direction, it is necessary to determine the edge points of each model block in that coordinate axis direction separately, and then select the target edge point from multiple edge points.
[0142] Assume that a first model block and a second model block exist in any one of the plurality of coordinate axis directions and in a second coordinate axis direction. According to the above calculation method, the edge point in the first model block whose projection point is farthest from the virtual center point is the first edge point, with coordinates (x1, y1, z1). The edge point in the second model block whose projection point is farthest from the virtual center point is the second edge point, with coordinates (x2, y2, z2).
[0143] Assuming that the second coordinate axis is the Y axis, calculate the third projection point of the first edge point in the Y axis direction, the coordinate is (x c ,y1,z c ), the fourth projection point of the second edge point in the Y-axis direction, the coordinate is (x c ,y2,z c ). Then calculate the third distance from the third projection point to the virtual center point, and the fourth distance from the fourth projection point to the virtual center point:
[0144] ;
[0145] Among them, D3 is the third distance, and D4 is the third distance.
[0146] Compare the third distance and the fourth distance. If D3>D4, the third model point is the target edge point. If D3=D4, the third model point or the fourth model point is the target edge point. If D3<D4, the fourth model point is the target edge point.
[0147] Finally, a real-time bounding box is constructed based on the edge points. Any side of the real-time bounding box is perpendicular or parallel to the direction of travel and passes through the target edge point, thereby ensuring that the real-time bounding box is tangent to the virtual character model.
[0148] S130 , judging whether a plurality of virtual models will collide based on the real-time bounding box and the position data of the virtual models.
[0149] Virtual models have a large number of model points, and their shapes vary at different times. Calculating whether multiple virtual models collide directly based on these model points is computationally intensive. Therefore, to reduce the computational complexity, we determine whether the real-time bounding boxes of the virtual models at different times overlap, thereby determining whether the virtual models collide.
[0150] In one possible embodiment, determining whether multiple virtual models will collide based on real-time bounding boxes and position data of virtual models specifically includes: obtaining first bounding boxes of a first virtual model at multiple different moments and second bounding boxes of a second virtual model at multiple different moments within a preset time period, where the first virtual model and the second virtual model are any two virtual models from the multiple virtual models; determining a first volume of each first bounding box and a second volume of each second bounding box; sorting the multiple first volumes in ascending order of volume value to obtain a first sorting result, and sorting the multiple second volumes in ascending order of volume value to obtain a second sorting result; determining a first volume with a largest volume value based on the first sorting result, and determining a first bounding box corresponding to the first volume with the largest volume value as a first target bounding box; determining a second volume with a largest volume value based on the second sorting result, and determining a second bounding box corresponding to the second volume with the largest volume value as a second target bounding box; calculating first positions of the first target bounding box at multiple different moments and second positions of the second target bounding box at multiple different moments after the preset time period; and determining whether the first target bounding box and the second target bounding box overlap based on the first and second positions at the same moments, thereby determining whether the first virtual model and the second virtual model will collide.
[0151] Specifically, a distance is described using any two virtual models from the plurality of virtual models, namely, a first virtual model and a second virtual model. For the first virtual model, bounding box data at multiple different moments within a preset historical time period is obtained, including the first volume of the first bounding box at each of the different moments. For the second virtual model, bounding box data at multiple different moments within the preset historical time period is obtained, including the second volume of the second bounding box at each of the different moments.
[0152] The volume of the real-time bounding box can be calculated by the maximum and minimum coordinates of the bounding box at different times. Figure 2 , place the bounding box into the preset coordinate system, the minimum point is the smallest point of the bounding box on all coordinate axes. For a bounding box, each coordinate value of the minimum point is the minimum value of the coordinate values of all vertices of the bounding box on the corresponding coordinate axis. The coordinate is (x min ,y min , z min ), the minimum point coordinates are calculated as follows:
[0153] ;
[0154] Among them, (x i ,y i , z i ) are the coordinates of the bounding box vertices, i∈(1, 2, …, n).
[0155] Similarly, for a bounding box, each coordinate value of the maximum point is the maximum value of the coordinate values of all vertices of the bounding box on the corresponding coordinate axis. The coordinate is (x max ,y max , z max ), the maximum point coordinates are calculated as follows:
[0156] ;
[0157] Among them, (x i ,y i , z i ) are the coordinates of the bounding box vertices, i∈(1, 2, …, n).
[0158] The maximum point and minimum point of the bounding box define the boundaries of the bounding box in three-dimensional space. The X coordinate of the minimum point represents the minimum boundary of the bounding box on the X axis, the Y coordinate of the minimum point represents the minimum boundary of the bounding box on the Y axis, and the Z coordinate of the minimum point represents the minimum boundary of the bounding box on the Z axis. The X coordinate of the maximum point represents the maximum boundary of the bounding box on the X axis, the Y coordinate of the maximum point represents the maximum boundary of the bounding box on the Y axis, and the Z coordinate of the maximum point represents the maximum boundary of the bounding box on the Z axis. Figure 7 , for the bounding box, the minimum point (x min ,y min , z min ) may be the three boundaries shown by the solid lines in the figure.
[0159] Furthermore, since the virtual model moves dynamically, the position of the bounding box needs to be updated according to each frame or time interval. Assuming that the distance moved by the virtual character model is (Δx, Δy, Δz), the boundary of the bounding box can be updated as follows:
[0160] ;
[0161] Among them, the minimum point coordinate of the updated bounding box is (x min ',y min ', z min '), the maximum point coordinate is (x max ',y max ', z max ').
[0162] Referring to the above principle, the first volume of the first bounding box and the second volume of the second bounding box are calculated at different times within the preset time period. The specific calculation process is as follows:
[0163] ;
[0164] Among them, V 1,ti is the first volume of the first bounding box at the i-th moment, (x1 max,ti ,y 1 max,ti , z 1 max,ti ) is the coordinate of the first maximum point of the first bounding box at the i-th moment, (x 1 min,ti ,y 1 min,ti , z 1 min,ti ) is the coordinate of the first minimum point of the first bounding box at the i-th moment, V 2,ti is the second volume of the second bounding box at the i-th moment, (x 2 max,ti ,y 2 max,ti , z 2 max,ti ) is the coordinate of the second largest point of the second bounding box at the i-th moment, (x 2 min,ti ,y 2 min,ti , z 2 min,ti ) is the coordinate of the second minimum point of the second bounding box at the i-th moment.
[0165] Sort multiple first volumes according to their volume values from small to large to obtain a first sorting result, and sort multiple second volumes according to their volume values from small to large to obtain a second sorting result; determine the first volume with the largest volume value based on the first sorting result, and determine the first bounding box corresponding to the first volume with the largest volume value as the first target bounding box for subsequent calculations; determine the second volume with the largest volume value based on the second sorting result, and determine the second bounding box corresponding to the second volume with the largest volume value as the second target bounding box for subsequent calculations.
[0166] According to the first velocity and first acceleration of the current first virtual model and the second velocity and acceleration of the second virtual model, the first moving distance (Δx 1,ti , Δy 1,ti , Δz 1,ti ), and calculate the second moving distance (Δx 2,ti , Δy 2,ti , Δz 2,ti ), the specific calculation method is only a conventional technical means in the relevant technical field and will not be further elaborated here.
[0167] After calculating the preset time period, the first target bounding box is at the first position at multiple different times, and the second target bounding box is at the second position at multiple different times. Specifically, based on the calculated first movement distance, the first minimum point coordinates and the first maximum point coordinates of the first target bounding box are updated; based on the calculated second movement distance, the second minimum point coordinates and the second maximum point coordinates of the second target bounding box are updated as follows:
[0168] ;
[0169] Where (Δx 1,ti , Δy 1,ti , Δz 1,ti ) is the first moving distance of the first virtual model up to the i-th moment, (Δx 2,ti , Δy 2,ti , Δz 2,ti ) is the second moving distance of the second virtual model up to the i-th moment, (x 1,min ',y 1,min ', z 1,min ') is the coordinate of the first minimum point of the first target bounding box at the i-th moment, (x 1,max ',y 1,max ', z 1,max ') is the coordinate of the first maximum point of the first target bounding box at the i-th moment, (x 2,min ',y 2,min ', z 2,min ') is the coordinate of the second minimum point of the second target bounding box at the i-th moment, (x 2,max ',y 2,max ', z 2,max ') is the coordinate of the second maximum point of the second target bounding box at the i-th moment.
[0170] Based on the first position and the second position at the same time, it is determined whether the first target bounding box and the second target bounding box overlap, thereby determining whether the first virtual model and the second virtual model collide. Specifically, it is determined whether the first minimum point coordinate and the first maximum point coordinate of the first target bounding box, and the second minimum point coordinate and the second maximum point coordinate of the second target bounding box meet the following preset conditions:
[0171] x 1,max '≥x 2,min ';
[0172] x 1,min '≤x 2,max ';
[0173] y 1,max '≥y 2,min ';
[0174] y 1,min '≤y2,max ';
[0175] z 1,max '≥z 2,min ';
[0176] z 1,min '≤z 2,max '.
[0177] When the first minimum point coordinates and the first maximum point coordinates of the first target bounding box, and the second minimum point coordinates and the second maximum point coordinates of the second target bounding box meet the preset conditions, it indicates that the side of the first target bounding box intersects with the side of the second target bounding box. Then, it is determined that at this moment, the first target bounding box and the second target bounding box overlap, and the first virtual model may collide with the second virtual model.
[0178] S140 , planning an avoidance path for the virtual model based on the real-time position of the virtual model.
[0179] In one possible implementation, based on the real-time position of the virtual model, an avoidance path of the virtual model is planned, specifically including: obtaining the collision point position of the collision point; calculating the collision distance between the real-time position and the collision point position; determining the adjustment distance according to the collision distance; calculating the adjustment speed of the virtual model based on the collision distance, the adjustment distance and the current speed of the virtual model; and planning the adjustment path of the virtual model according to the adjustment speed.
[0180] Specifically, refer to Figure 6 Assuming that, according to steps S110-S130, it is determined that the first virtual model and the second virtual model are about to collide, to ensure that the virtual character models can move freely while avoiding collision, thereby providing a smoother and more natural interactive experience in the virtual reality environment, the speeds of multiple virtual models can be adjusted simultaneously to avoid collision. Specifically, the forward speed of the first virtual model can be reduced while the forward speed of the second virtual model is increased, or the forward speed of the first virtual model can be increased while the forward speed of the second virtual model is reduced, thereby avoiding collision between the first and second virtual models.
[0181] The coordinates of the collision point are directly determined based on the first minimum point coordinates and the first maximum point coordinates of the first target bounding box that meet the preset conditions, and the second minimum point coordinates and the second maximum point coordinates of the second target bounding box, which are obtained in step S130. Alternatively, the coordinates of the collision point are calculated based on the first current position and first velocity of the first virtual model and the second current position and second velocity of the second virtual model.
[0182] When the first virtual model collides with the second virtual model, assuming that they are at the same position, the collision time can be calculated using the following formula:
[0183] ;
[0184] Where T is the collision time, (X1, Y1, Z1) is the first current position, (X2, Y2, Z2) is the second current position, (V 1X , V 1Y , V 1Z ) is the velocity vector of the first velocity, (V 2X , V 2Y , V 2Z ) is the velocity vector of the second velocity.
[0185] Then calculate the relative velocity vector of the first velocity and the second velocity, Vr=(V 1X -V 2X , V 1Y -V 2Y , V 1Z -V 1Z ).
[0186] Finally, calculate the collision point position P', specifically: P'=P1+T·V r , or P'=P2+T·V r , where P1 is the first current position and P2 is the second current position.
[0187] According to the above scheme, if the collision point position is (X c , Y c , Z c ), the collision distance between the real-time position of the first model and the collision point position is:
[0188] ;
[0189] Then the collision distance between the real-time position of the second model and the collision point position is:
[0190] ;
[0191] The adjustment distance is set according to the collision distance. The adjustment distance can be half of the collision distance or other multiples. Finally, based on the collision distance, the adjustment distance and the current speed of the virtual model, the adjustment speed of the virtual model is calculated using the following formula:
[0192] ;
[0193] Where V' is the adjusted speed, V is the current speed, and D is the adjusted distance.
[0194] Finally, the movement speed of the virtual model is replanned, including controlling the first model to move forward at the adjusted speed, or controlling the second model to move forward at the adjusted speed, so that the virtual model moves at the adjusted speed and multiple virtual models avoid collision.
[0195] By adopting the technical solution of this application, the direction and position data of multiple virtual models are acquired in real time, and a real-time bounding box parallel to the line of sight is constructed to accurately determine potential collisions. When a potential collision is detected, a path planning algorithm is used to plan an avoidance path based on the real-time position of the virtual model, ensuring that the virtual model avoids the collision point, thereby effectively avoiding collisions and improving the interactive fluidity and realism of the virtual environment.
[0196] This embodiment also discloses a multi-person collaborative interactive control device, referring to Figure 8 The device includes an acquisition module 801, a construction module 802, a judgment module 803 and a processing module 804, wherein:
[0197] The acquisition module 801 is used to respectively acquire the moving directions of the multiple virtual models.
[0198] The construction module 802 is configured to construct a real-time bounding box of the virtual model based on the traveling direction, wherein multiple sides of the real-time bounding box are parallel to the line of sight of the virtual model.
[0199] The judgment module 803 is used to judge whether multiple virtual models will collide based on the real-time bounding box and the position data of the virtual models.
[0200] The processing module 804 is configured to plan an avoidance path for the virtual models based on the real-time positions of the virtual models if it is determined that the multiple virtual models will collide.
[0201] In a possible implementation, the acquisition module 801 is configured to acquire a virtual center point of the virtual model.
[0202] The construction module 802 is used to construct a three-dimensional model coordinate system with the virtual center point as the origin and the moving direction as any one of the multiple coordinate axis directions.
[0203] The judgment module 803 is used to determine the model blocks of the virtual model in the direction of each coordinate axis. The model blocks are the models after the virtual model is segmented.
[0204] The processing module 804 is used to calculate the target edge points of the model block in each coordinate axis direction.
[0205] The construction module 802 is used to construct a real-time bounding box, wherein the target edge point is located on the side of the real-time bounding box.
[0206] In one possible implementation, the judgment module 803 is used to determine the first model block in the first travel axis direction, the first travel axis direction is the same as the travel direction, the first model block includes the hand model and the leg model of the virtual model, and the first travel axis direction is the same as the travel direction.
[0207] The judgment module 803 is used to determine a second model block in a second travel axis direction, where the second travel axis direction is opposite to the travel direction, and the second model block includes a foot model and an arm model of the virtual model.
[0208] The judgment module 803 is used to determine a first side model block in a first horizontal axis direction, where the first horizontal axis direction is perpendicular to the traveling direction and parallel to a preset horizontal plane, and the first side model block includes a left arm model.
[0209] The judgment module 803 is used to determine the second side model block in the second horizontal axis direction. The second horizontal axis direction is perpendicular to the traveling direction and parallel to the preset horizontal plane. The second horizontal axis direction is opposite to the first horizontal axis direction. The second side model block includes a right arm model.
[0210] The judgment module 803 is used to determine a first top model block in a first vertical axis direction, where the first vertical axis direction is perpendicular to the traveling direction and perpendicular to a preset horizontal plane, and the first top model block includes a head model.
[0211] The judgment module 803 is used to determine a second top model block in a second vertical axis direction, where the second vertical axis direction is perpendicular to the traveling direction and perpendicular to a preset horizontal plane, and is opposite to the first vertical axis direction. The second top model block includes a foot model.
[0212] In a possible implementation, the judgment module 803 is used to determine a first model point and a second model point in the direction of the first coordinate axis, where the first model point and the second model point are any two model points on the first model block, and the first coordinate axis direction is any one of multiple coordinate axis directions.
[0213] The judgment module 803 is used to determine a first projection point of the first model point in the direction of the first coordinate axis, and a second projection point of the second model point in the direction of the first coordinate axis.
[0214] The processing module 804 is configured to calculate a first distance from the first projection point to the virtual center point and a second distance from the second projection point to the virtual center point.
[0215] The judgment module 803 is configured to determine that the first model point is a target edge point if it is determined that the first distance is greater than the second distance.
[0216] In a possible implementation, the judgment module 803 is configured to determine the first model block and the second model block in a second coordinate axis direction, where the second coordinate axis direction is any one of a plurality of coordinate axis directions.
[0217] The judgment module 803 is configured to determine a first edge point of the first model block and a second edge point of the second model block.
[0218] The judgment module 803 is used to determine a third projection point of the first edge point in the direction of the second coordinate axis, and a fourth projection point of the second edge point in the direction of the second coordinate axis.
[0219] The processing module 804 is configured to calculate a third distance from the third projection point to the virtual center point and a fourth distance from the fourth projection point to the virtual center point.
[0220] The judgment module 803 is configured to determine that the first edge point is a target edge point if it is determined that the third distance is greater than the fourth distance.
[0221] In a possible implementation, the acquisition module 801 is used to acquire the first bounding box of the first virtual model at multiple different moments and the second bounding box of the second virtual model at multiple different moments within a preset time period, where the first virtual model and the second virtual model are any two virtual models among the multiple virtual models.
[0222] The judgment module 803 is used to determine the first volume of each first bounding box and the second volume of each second bounding box.
[0223] The processing module 804 is configured to sort the plurality of first volumes in ascending order according to their volume values to obtain a first sorting result, and to sort the plurality of second volumes in ascending order according to their volume values to obtain a second sorting result.
[0224] Judgment module 803 is used to determine the first volume with the largest volume value according to the first sorting result, and determine the first bounding box corresponding to the first volume with the largest volume value as the first target bounding box, determine the second volume with the largest volume value according to the second sorting result, and determine the second bounding box corresponding to the second volume with the largest volume value as the second target bounding box.
[0225] The processing module 804 is configured to calculate the first position of the first target bounding box at a plurality of different moments and the second position of the second target bounding box at a plurality of different moments after a preset time period.
[0226] The judgment module 803 is configured to judge whether the first target bounding box and the second target bounding box overlap based on the first position and the second position at the same time, thereby determining whether the first virtual model and the second virtual model collide.
[0227] In a possible implementation, the acquisition module 801 is configured to acquire a collision point position of a collision point.
[0228] The processing module 804 is configured to calculate the collision distance between the real-time position and the collision point position.
[0229] The processing module 804 is configured to determine an adjustment distance according to the collision distance.
[0230] The processing module 804 is configured to calculate the adjustment speed of the virtual model based on the collision distance, the adjustment distance, and the current speed of the virtual model.
[0231] The processing module 804 is used to plan an adjustment path of the virtual model according to the adjustment speed.
[0232] It should be noted that the above embodiments provide devices that implement their functions using only the division of the above functional modules as examples. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above. In addition, the device and method embodiments provided in the above embodiments are based on the same concept. The specific implementation process is detailed in the method embodiment and will not be repeated here.
[0233] This embodiment also discloses an electronic device, referring to Figure 9 The electronic device may include: at least one processor 901 , at least one communication bus 902 , a user interface 903 , a network interface 904 , and at least one memory 905 .
[0234] The communication bus 902 is used to implement connection and communication between these components.
[0235] The user interface 903 may include a display screen (Display) and a camera (Camera). Optionally, the user interface 903 may also include a standard wired interface and a wireless interface.
[0236] The network interface 904 may optionally include a standard wired interface or a wireless interface (such as a WI-FI interface).
[0237] The processor 901 may include one or more processing cores. Using various interfaces and circuits, the processor 901 connects to various components within the server. It executes instructions, programs, code sets, or instruction sets stored in the memory 905, as well as accesses data stored in the memory 905, to perform various server functions and process data. Optionally, the processor 901 may be implemented using at least one of the following hardware forms: a digital signal processing (DSP), a field-programmable gate array (FPGA), or a programmable logic array (PLA). The processor 901 may integrate one or a combination of a central processing unit (CPU), a graphics processing unit (GPU), and a modem. The CPU primarily processes the operating system, user interface, and application programs; the GPU is responsible for rendering and drawing content displayed on the display screen; and the modem handles wireless communications. It is understood that the modem may also be implemented independently of the processor 901 and implemented on a separate chip.
[0238] Memory 905 may include random access memory (RAM) or read-only memory (ROM). Optionally, the memory may include non-transitory computer-readable storage medium. Memory 905 may be used to store instructions, programs, code, code sets, or instruction sets. Memory 905 may include a program storage area and a data storage area. The program storage area may store instructions for implementing an operating system, instructions for at least one function (such as a touch function, sound playback function, image playback function, etc.), instructions for implementing the aforementioned method embodiments, etc.; the data storage area may store data related to the aforementioned method embodiments, etc. Memory 905 may also optionally be at least one storage device located remotely from the aforementioned processor 901. Memory 905, as a computer storage medium, may include an operating system, a network communication module, a user interface 903 module, and an application program for a multi-person collaborative interactive control method.
[0239] exist Figure 9In the electronic device shown, the user interface 903 is mainly used to provide an input interface for the user and obtain data input by the user; and the processor 901 can be used to call an application program storing a multi-person collaborative interaction control method in the memory 905. When executed by one or more processors 901, the electronic device executes one or more methods in the above embodiments.
[0240] It should be noted that for the aforementioned method embodiments, for simplicity of description, they are all expressed as a series of action combinations, but those skilled in the art should be aware that this application is not limited by the order of the actions described, because according to this application, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required for this application.
[0241] In the above embodiments, the description of each embodiment has its own focus. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0242] In the several embodiments provided in this application, it should be understood that the disclosed devices can be implemented in other ways. For example, the device embodiments described above are merely schematic, such as the division of units, which is only a logical function division. In actual implementation, there may be other division methods, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some service interface, and the indirect coupling or communication connection of devices or units can be electrical or other forms.
[0243] Units described as separate components may or may not be physically separate, and components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of these units may be selected to achieve the purpose of this embodiment according to actual needs.
[0244] In addition, the functional units in the various embodiments of the present application may be integrated into a single processing unit, or each unit may exist physically separately, or two or more units may be integrated into a single unit. The aforementioned integrated units may be implemented in the form of hardware or software functional units.
[0245] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable memory. Based on this understanding, the technical solution of this application, or the portion that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a memory 905 and includes several instructions for causing a computer device (which can be a personal computer, server, or network device, etc.) to execute all or part of the steps of the various embodiments of the method of this application. The aforementioned memory 905 includes various media that can store program code, such as a USB flash drive, a mobile hard drive, a magnetic disk, or an optical disk.
[0246] The present application also discloses a computer-readable storage medium storing instructions, which, when executed by one or more processors 901, enable an electronic device to execute one or more of the methods described in the above embodiments.
[0247] The above is only an exemplary embodiment of the present disclosure and cannot be used to limit the scope of the present disclosure. That is, any equivalent changes and modifications made according to the teachings of the present disclosure are still within the scope of the present disclosure. After considering the disclosure of the specification and practice, those skilled in the art will easily think of other embodiments of the present disclosure. This application is intended to cover any variation, use or adaptive change of the present disclosure, which follows the general principles of the present disclosure and includes common knowledge or customary technical means in the art that are not recorded in the present disclosure. The description and examples are to be regarded as exemplary only, and the scope and spirit of the present disclosure are defined by the claims.
Claims
1. A multi-person collaborative interactive control method, characterized in that: The method comprises: respectively obtaining the traveling directions of the multiple virtual models; Based on the traveling direction, constructing a real-time bounding box of the virtual model, wherein multiple sides of the real-time bounding box are parallel to the line of sight of the virtual model; Determining whether a plurality of virtual models will collide based on the real-time bounding box and the position data of the virtual models; The determining, based on the real-time bounding box and the position data of the virtual models, whether the multiple virtual models collide specifically includes: Obtaining first bounding boxes of a first virtual model at multiple different moments and second bounding boxes of a second virtual model at multiple different moments within a preset time period, where the first virtual model and the second virtual model are any two virtual models from the multiple virtual models; determining a first volume of each first bounding box and a second volume of each second bounding box; sorting the multiple first volumes in ascending order of volume value to obtain a first sorting result, and sorting the multiple second volumes in ascending order of volume value to obtain a second sorting result; determining a first volume with the largest volume value based on the first sorting result, and determining a first bounding box corresponding to the first volume with the largest volume value as a first target bounding box; determining a second volume with the largest volume value based on the second sorting result, and determining a second bounding box corresponding to the second volume with the largest volume value as a second target bounding box; calculating the first position of the first target bounding box at multiple different moments and the second position of the second target bounding box at multiple different moments after the preset time period; determining whether the first target bounding box and the second target bounding box overlap based on the first position and the second position at the same moment, thereby determining whether the first virtual model and the second virtual model collide; If it is determined that a plurality of the virtual models will collide, avoidance paths of the virtual models are planned based on the real-time positions of the virtual models.
2. A multi-person collaborative interactive control method according to claim 1, characterized in that: The constructing of a real-time bounding box of the virtual model based on the traveling direction specifically includes: Obtaining the virtual center point of the virtual model; Constructing a three-dimensional model coordinate system with the virtual center point as the origin and the moving direction as any one of a plurality of coordinate axis directions; Determining model blocks of the virtual model in the directions of each of the coordinate axes, wherein the model blocks are models obtained by segmenting the virtual model; Calculating the target edge points of the model block in each of the coordinate axis directions respectively; The real-time bounding box is constructed, wherein the target edge point is located on a side of the real-time bounding box.
3. The multi-person collaborative interactive control method according to claim 2, characterized in that: Determining the model blocks of the virtual model in the directions of the respective coordinate axes specifically includes: Determining a first model block in a first travel axis direction, where the first travel axis direction is the same as the travel direction, the first model block including a hand model and a leg model of the virtual model; determining a second model block in a second travel axis direction, the second travel axis direction being opposite to the travel direction, the second model block including a foot model and an arm model of the virtual model; Determine a first side model block in a first horizontal axis direction, where the first horizontal axis direction is perpendicular to the traveling direction and parallel to a preset horizontal plane, the first side model block including a left arm model; Determine a second side model block in a second horizontal axis direction, wherein the second horizontal axis direction is perpendicular to the traveling direction and parallel to the preset horizontal plane, the second horizontal axis direction is opposite to the first horizontal axis direction, and the second side model block includes a right arm model; Determining a first top model block in a first vertical axis direction, wherein the first vertical axis direction is perpendicular to the traveling direction and perpendicular to the preset horizontal plane, the first top model block including a head model; A second top model block in a second vertical axis direction is determined, wherein the second vertical axis direction is perpendicular to the traveling direction and perpendicular to the preset horizontal plane, the second vertical axis direction is opposite to the first vertical axis direction, and the second top model block includes a foot model.
4. The multi-person collaborative interactive control method according to claim 2, characterized in that: The step of respectively calculating the target edge points of the model block in the directions of the coordinate axes specifically includes: Determine a first model point and a second model point in a first coordinate axis direction, where the first model point and the second model point are any two model points on a first model block, and the first coordinate axis direction is any one of a plurality of coordinate axis directions; Determine a first projection point of the first model point in the direction of the first coordinate axis, and a second projection point of the second model point in the direction of the first coordinate axis; Calculating a first distance from the first projection point to the virtual center point, and a second distance from the second projection point to the virtual center point; If it is determined that the first distance is greater than the second distance, the first model point is determined to be the target edge point.
5. The multi-person collaborative interactive control method according to claim 2, characterized in that: The step of respectively calculating the target edge points of the model block in the directions of the coordinate axes further includes: Determine a first model block and a second model block in a second coordinate axis direction, where the second coordinate axis direction is any one of the plurality of coordinate axis directions; determining a first edge point of the first model block and a second edge point of the second model block; Determine a third projection point of the first edge point in the direction of the second coordinate axis, and a fourth projection point of the second edge point in the direction of the second coordinate axis; Calculating a third distance from the third projection point to the virtual center point and a fourth distance from the fourth projection point to the virtual center point; If it is determined that the third distance is greater than the fourth distance, the first edge point is determined to be the target edge point.
6. The multi-person collaborative interactive control method according to claim 1, characterized in that: Planning an avoidance path for the virtual model based on the real-time position of the virtual model specifically includes: Get the collision point position of the collision point; Calculating a collision distance between the real-time position and the collision point position; determining an adjustment distance according to the collision distance; calculating an adjusted speed of the virtual model based on the collision distance, the adjusted distance, and the current speed of the virtual model; An adjustment path of the virtual model is planned according to the adjustment speed.
7. A multi-person collaborative interactive control device, characterized in that: The device includes an acquisition module, a construction module, a judgment module and a processing module, wherein: The acquisition module is used to respectively acquire the moving directions of the multiple virtual models; The construction module is configured to construct a real-time bounding box of the virtual model based on the traveling direction, wherein multiple sides of the real-time bounding box are parallel to the line of sight of the virtual model; The judgment module is used to judge whether a plurality of virtual models will collide based on the real-time bounding box and the position data of the virtual model; the judgment of whether a plurality of virtual models will collide based on the real-time bounding box and the position data of the virtual model specifically includes: obtaining a first bounding box of a first virtual model at a plurality of different moments and a second bounding box of a second virtual model at a plurality of different moments within a preset time period, wherein the first virtual model and the second virtual model are any two virtual models among the plurality of virtual models; determining a first volume of each first bounding box and a second volume of each second bounding box; sorting the plurality of first volumes in ascending order according to the volume value to obtain a first sorting result, and sorting the plurality of second volumes in ascending order according to the volume value The values are sorted from small to large to obtain a second sorting result; a first volume with the largest volume value is determined according to the first sorting result, and a first bounding box corresponding to the first volume with the largest volume value is determined as a first target bounding box; a second volume with the largest volume value is determined according to the second sorting result, and a second bounding box corresponding to the second volume with the largest volume value is determined as a second target bounding box; after calculating a preset time period, the first target bounding box is at a first position at multiple different moments, and the second target bounding box is at a second position at multiple different moments; based on the first position and the second position at the same moment, whether the first target bounding box and the second target bounding box overlap, thereby determining whether the first virtual model and the second virtual model collide; The processing module is configured to plan an avoidance path for the virtual models based on the real-time positions of the virtual models if it is determined that the multiple virtual models will collide.
8. An electronic device, characterized in that: The electronic device comprises a processor, a memory, a user interface, a network interface and a memory, wherein the memory is used to store instructions, the user interface and the network interface are both used to communicate with other devices, and the processor is used to execute the instructions stored in the memory so that the electronic device executes the method according to any one of claims 1 to 6.
9. A computer-readable storage medium, characterized in that The computer-readable storage medium stores instructions, and when the instructions are executed, the method according to any one of claims 1 to 6 is executed.
Citation Information
Patent Citations
Game control method and device, electronic equipment and storage medium
CN112807681A
State control method and device for virtual carrier in virtual scene and electronic equipment
CN117563229A