Method, apparatus, device, and storage medium for controlling the movement of a virtual object

By storing the terrain information of the virtual environment in the terminal, calculating the passable distance value of the virtual object and adjusting the movement direction, the problem of large storage space and low control accuracy of voxel data is solved, and efficient virtual object movement control is achieved.

CN113384902BActive Publication Date: 2025-07-25TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202011315153.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-11-20
Publication Date
2025-07-25
Estimated Expiration
2040-11-20

AI Technical Summary

Technical Problem

In the prior art, the voxel data of the terminal storage virtual environment occupies a large amount of storage space, resulting in poor movement control performance of virtual objects, and the virtual objects cannot accurately adjust the movement direction during collision detection, resulting in low control accuracy.

Method used

The terminal stores the terrain information of at least two virtual terrain units of the virtual environment, calculates the passable distance value by determining the location and radius of the target virtual object, and adjusts the new movement direction of the virtual object to avoid collision.

Benefits of technology

It reduces storage space requirements, improves the movement control performance of virtual objects, and accurately adjusts the movement direction in the event of collision, improving the accuracy of control.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113384902B_ABST
    Figure CN113384902B_ABST
Patent Text Reader

Abstract

The present application discloses a method, apparatus, device and storage medium for controlling the movement of virtual objects. The method includes: in response to a movement instruction of a target virtual object, determining target position information corresponding to the target virtual object and the radius of the target virtual object; based on the target position information and the terrain information of at least two virtual terrain units, determining a target passable distance value corresponding to the target virtual object; in response to the target passable distance value being not greater than the radius of the target virtual object, determining a new movement direction of the target virtual object based on the original movement direction of the target virtual object, and controlling the target virtual object to move in the new movement direction. In this way, the storage space occupied by the terrain information is small, which is beneficial to improving the movement control performance of virtual objects; in addition, when it is determined that the virtual object cannot continue to move in the original movement direction, controlling the virtual object to move in the new movement direction makes the movement control of the virtual object highly accurate.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present application relate to the field of computer technology, and particularly to a method, device, equipment and storage medium for controlling the movement of virtual objects. Background Art

[0002] With the rapid development of computer technology, there are more and more application programs that can provide virtual environments. Terminals installed with such application programs that can provide virtual environments need to control the movement of virtual objects in the virtual environment in real time according to the virtual terrain in the virtual environment.

[0003] In the related art, the terminal stores voxel data after voxelizing the virtual terrain in the virtual environment, and then controls the movement of the virtual object according to the collision detection result between the virtual object and the voxel data.

[0004] In the above manner, the storage of voxel data requires a large amount of storage space, resulting in poor performance of the terminal in controlling the movement of virtual objects. In addition, in the process of controlling the movement of virtual objects according to the collision detection result between virtual objects and voxel data, if it is determined that the virtual object cannot move in the original movement direction due to a collision with the edge of the virtual terrain, the terminal will control the virtual object to stay in place, resulting in low accuracy of the movement control of the virtual object. Summary of the Invention

[0005] The embodiments of the present application provide a method, device, equipment and storage medium for controlling the movement of virtual objects, which can be used to improve the accuracy of the movement control of virtual objects. The technical solutions are as follows:

[0006] On the one hand, the embodiments of the present application provide a method for controlling the movement of virtual objects. The method is applied to a terminal that stores terrain information of at least two virtual terrain units corresponding to a virtual environment. The method includes:

[0007] Responding to a movement instruction of a target virtual object, determining target position information corresponding to the target virtual object and the radius of the target virtual object;

[0008] Based on the target position information and the terrain information of the at least two virtual terrain units, determining a target passable distance value corresponding to the target virtual object;

[0009] Responding to the target passable distance value being not greater than the radius of the target virtual object, determining a new movement direction of the target virtual object based on the original movement direction of the target virtual object, and controlling the target virtual object to move in the new movement direction.

[0010] On the other hand, a device for controlling the movement of virtual objects is provided. The device includes:

[0011] A first determination unit, configured to determine target position information corresponding to the target virtual object and a radius of the target virtual object in response to a movement instruction of the target virtual object.

[0012] A second determination unit, configured to determine a target passable distance value corresponding to the target virtual object based on the target position information and terrain information of the at least two virtual terrain units.

[0013] A third determination unit, configured to, in response to the target passable distance value being not greater than the radius of the target virtual object, determine a new movement direction of the target virtual object based on an original movement direction of the target virtual object.

[0014] A control unit, configured to control the target virtual object to move in the new movement direction.

[0015] In a possible implementation manner, the target position information includes a target plane coordinate and a target height value. Different virtual terrain units correspond to different plane regions. Terrain information of any virtual terrain unit includes height values of virtual terrain grids constituting the any virtual terrain unit. The second determination unit is configured to determine a target virtual terrain unit from the at least two virtual terrain units based on the target plane coordinate and plane regions respectively corresponding to the at least two virtual terrain units; determine a target virtual terrain grid from the virtual terrain grids constituting the target virtual terrain unit based on the target height value and height values of the virtual terrain grids constituting the target virtual terrain unit; and determine a target passable distance value corresponding to the target virtual object based on the target virtual terrain grid.

[0016] In a possible implementation manner, the terrain information of the any virtual terrain unit further includes passable distance values of virtual terrain grids constituting the any virtual terrain unit. The second determination unit is further configured to determine first adjacent virtual terrain grids corresponding to the target virtual terrain grid; and determine the target passable distance value corresponding to the target virtual object based on the passable distance values of the first adjacent virtual terrain grids and a distance between the target plane coordinate and a reference boundary of the target plane region, where the target plane region is a plane region corresponding to the target virtual terrain unit.

[0017] In a possible implementation, there is a target dynamic obstacle in the virtual environment. The second determination unit is further configured to determine a first passable distance value corresponding to the target virtual object based on the target virtual terrain grid; determine a second passable distance value corresponding to the target virtual object based on the target plane coordinates and the planar projection of the target dynamic obstacle; and use the minimum value of the first passable distance value and the second passable distance value as the target passable distance value corresponding to the target virtual object.

[0018] In a possible implementation, the planar projection of the target dynamic obstacle is a target disk. The second determination unit is further configured to calculate a first distance between the planar coordinates of the center of the target disk and the target plane coordinates; and use the difference between the first distance and the radius of the target disk as the second passable distance value corresponding to the target virtual object.

[0019] In a possible implementation, the planar projection of the target dynamic obstacle is a target rectangle. The second determination unit is further configured to determine the second passable distance value corresponding to the target virtual object based on the target plane coordinates, the planar coordinates of the center of the target rectangle, the steering angle corresponding to the target rectangle, and the boundary distance corresponding to the center of the target rectangle.

[0020] In a possible implementation, the third determination unit is configured to determine the gradient direction corresponding to the target virtual object; and determine the new movement direction of the target virtual object based on the gradient direction and the original movement direction of the target virtual object.

[0021] In a possible implementation, the apparatus further includes:

[0022] A detection unit, configured to perform ray detection on the virtual terrain in the virtual environment to obtain height value information of at least two virtual terrain units corresponding to the virtual environment. The height value information of any virtual terrain unit includes the height values of the virtual terrain grids constituting the any virtual terrain unit;

[0023] An acquisition unit, configured to, for any one of the at least two virtual terrain units, acquire passable distance value information of the any virtual terrain unit based on the height value information of the any virtual terrain unit. The passable distance value information of any virtual terrain unit includes the passable distance values of the virtual terrain grids constituting the any virtual terrain unit;

[0024] The acquisition unit is further configured to obtain terrain information of at least two virtual terrain units corresponding to the virtual environment based on the height value information of the at least two virtual terrain units and the passable distance value information of the at least two virtual terrain units.

[0025] In a possible implementation, the obtaining unit is further configured to, for any virtual terrain grid that constitutes any virtual terrain unit, determine a first height value range corresponding to the any virtual terrain grid and a second height value range corresponding to the any virtual terrain grid based on the height value of the any virtual terrain grid; perform a ray detection on the first height value range and the second height value range to determine a passable distance value of the any virtual terrain grid.

[0026] In a possible implementation, the obtaining unit is further configured to emit a first horizontal ray outward from the first height value range, determine the ray length of the first horizontal ray, and use the minimum value in the ray length of the first horizontal ray as a first distance value corresponding to the any virtual terrain grid; emit a second horizontal ray from the outside to the second height value range, determine the horizontal distance between the termination position of the second horizontal ray and the grid center of the any virtual terrain grid, and use the maximum value in the horizontal distance between the termination position of the second horizontal ray and the grid center of the any virtual terrain grid as a second distance value corresponding to the any virtual terrain grid; use the minimum value in the first distance value and the second distance value as the passable distance value of the any virtual terrain grid.

[0027] In a possible implementation, the obtaining unit is further configured to use the sum of the height value of the any virtual terrain grid and a first parameter as a first lower bound; use the sum of the height value of the any virtual terrain grid and a second parameter as a first upper bound; use the height value range formed by the first lower bound and the first upper bound and corresponding to the any virtual terrain grid as the first height value range corresponding to the any virtual terrain grid; use the difference between the height value of the any virtual terrain grid and a third parameter as a second lower bound; use the height value of the any virtual terrain grid as a second upper bound; use the height value range formed by the second lower bound and the second upper bound and corresponding to the any virtual terrain grid as the second height value range corresponding to the any virtual terrain grid; where the first parameter is used to indicate the maximum height of an obstacle that a virtual object can cross, the second parameter is used to indicate the height of the virtual object, and the third parameter is used to indicate the maximum height of a virtual cliff that the virtual object can cross.

[0028] In a possible implementation, the control unit is further configured to, in response to the target passable distance value being greater than the radius of the target virtual object, control the target virtual object to move in the original moving direction.

[0029] On the other hand, a computer device is provided. The computer device includes a processor and a memory. At least one computer program is stored in the memory and is loaded and executed by the processor to implement the method for controlling the movement of a virtual object as described in any one of the above.

[0030] On the other hand, a computer-readable storage medium is further provided. At least one computer program is stored in the computer-readable storage medium and is loaded and executed by a processor to implement the method for controlling the movement of a virtual object as described in any one of the above.

[0031] On the other hand, a computer program product or a computer program is further provided. The computer program product or the computer program includes computer instructions, and the computer instructions are stored in a computer-readable storage medium. The processor of the computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes the method for controlling the movement of a virtual object as described in any one of the above.

[0032] The technical solutions provided in the embodiments of the present application at least bring the following beneficial effects:

[0033] In the embodiments of the present application, the terminal stores the terrain information of at least two virtual terrain units corresponding to the virtual environment. Compared with storing voxel data, storing terrain information is beneficial to saving storage space, thereby improving the performance of controlling the movement of virtual objects. In addition, on the basis of pre-storing the terrain information of the virtual terrain unit, when it is determined that the virtual object cannot continue to move in the original movement direction, a new movement direction is determined and the virtual object is controlled to move in the new movement direction, so that the accuracy of controlling the movement of the virtual object is relatively high. BRIEF DESCRIPTION OF THE DRAWINGS

[0034] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following will briefly introduce the drawings required for the description of the embodiments. Obviously, the following drawings are only some embodiments of the present application. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts.

[0035] Figure 1 is a schematic diagram of the implementation environment of a method for controlling the movement of a virtual object provided by an embodiment of the present application;

[0036] Figure 2 is a flowchart of a method for controlling the movement of a virtual object provided by an embodiment of the present application;

[0037] Figure 3It is a schematic diagram of the positional relationship between a target virtual terrain grid and a first adjacent virtual terrain grid provided by an embodiment of the present application;

[0038] Figure 4 It is a schematic diagram of a target disc provided by an embodiment of the present application;

[0039] Figure 5 It is a schematic diagram of a target rectangle provided by an embodiment of the present application;

[0040] Figure 6 It is a schematic diagram of the relationship between a new movement direction, an original movement direction, and a gradient direction provided by an embodiment of the present application;

[0041] Figure 7 It is a schematic diagram of an interface for a virtual object to move in a multi-layer virtual terrain provided by an embodiment of the present application;

[0042] Figure 8 It is a flowchart of a method for obtaining terrain information of at least two virtual terrain units corresponding to a virtual environment provided by an embodiment of the present application;

[0043] Figure 9 It is a schematic diagram of obtaining the height value of a virtual terrain grid through ray detection provided by an embodiment of the present application;

[0044] Figure 10 It is a two-dimensional schematic diagram of performing ray detection on a first height value interval and a second height value interval provided by an embodiment of the present application;

[0045] Figure 11 It is a three-dimensional schematic diagram of performing ray detection on a first height value interval and a second height value interval provided by an embodiment of the present application;

[0046] Figure 12 It is a schematic diagram of the passable distance value of a virtual terrain grid provided by an embodiment of the present application;

[0047] Figure 13 It is a schematic diagram of a movement control device for a virtual object provided by an embodiment of the present application;

[0048] Figure 14 It is a schematic diagram of a movement control device for a virtual object provided by an embodiment of the present application;

[0049] Figure 15 It is a schematic diagram of the structure of a terminal provided by an embodiment of the present application. Detailed implementation manners

[0050] To make the objectives, technical solutions, and advantages of the present application clearer, the following will further describe the embodiments of the present application in detail with reference to the accompanying drawings.

[0051] The following explains several terms involved in the embodiments of this application:

[0052] Virtual environment: The environment provided (or displayed) when an application runs on a terminal. This virtual environment refers to an environment created for virtual objects to move in. The virtual environment can be a two-dimensional virtual environment, a 2.5D virtual environment, or a three-dimensional virtual environment. This virtual environment can be a simulation environment of the real world, a semi-simulated and semi-fictional environment, or a purely fictional environment. Exemplarily, the virtual environment in the embodiments of this application is a three-dimensional virtual environment.

[0053] Virtual object: A virtual object refers to an object that can move in a virtual environment. This movable object can be a virtual character, a virtual animal, an anime character, etc. The interaction object can control the virtual object by means of a peripheral component or by clicking on a touch display screen. Each virtual object has its own shape and volume in the virtual environment and occupies a part of the space in the virtual environment. Exemplarily, when the virtual environment is a three-dimensional virtual environment, the virtual object is a three-dimensional solid model created based on animation skeleton technology.

[0054] The embodiments of this application provide a method for controlling the movement of a virtual object. Please refer to Figure 1 , which shows a schematic diagram of the implementation environment of the method for controlling the movement of a virtual object provided by the embodiments of this application. This implementation environment includes: a terminal 11 and a server 12.

[0055] Among them, the terminal 11 is installed with an application that can provide a virtual environment. The terminal 11 can store the terrain information of at least two virtual terrain units corresponding to the virtual environment provided by the application, and then realize the control of the movement of the virtual object according to the terrain information of the at least two virtual terrain units stored in advance.

[0056] The embodiments of this application do not limit the type of the application that can provide a virtual environment. Exemplarily, an application that can provide a virtual environment refers to a game application, such as a third-person shooting (TPS) game, a first-person shooting (FPS) game, a multiplayer online battle arena (MOBA) game, a multiplayer gunfight survival game, etc. In an exemplary embodiment, the game application involved in the embodiments of this application is a game application based on frame synchronization. That is to say, the method for controlling the movement of a virtual object provided by the embodiments of this application can be applied to a game application based on frame synchronization.

[0057] Of course, in addition to game applications, applications that can provide virtual environments can also be other types of applications, such as virtual reality (VR) applications, augmented reality (AR) applications, 3D map programs, social applications, interactive entertainment applications, etc.

[0058] The server 12 is used to provide background services for the application installed on the terminal 11 that can provide a virtual environment. In a possible implementation, the server 12 undertakes the main computing work, and the terminal 11 undertakes the secondary computing work; or, the server 12 undertakes the secondary computing work, and the terminal 11 undertakes the main computing work; or, the server 12 and the terminal 11 adopt a distributed computing architecture for collaborative computing.

[0059] In a possible implementation, the terminal 11 is any electronic product that can perform human-computer interaction with the user through one or more methods such as a keyboard, touchpad, touch screen, remote control, voice interaction, or handwriting device. For example, a PC (Personal Computer), mobile phone, smart phone, PDA (Personal Digital Assistant), wearable device, pocket PC (PPC), tablet computer, smart vehicle computer, smart TV, smart speaker, etc. The server 12 can be a single server, or a server cluster composed of multiple server units, or a cloud computing service center. The terminal 11 and the server 12 establish a communication connection through a wired or wireless network.

[0060] Those skilled in the art should understand that the above-mentioned terminal 11 and server 12 are only examples. Other existing or future terminal or server that can be applied to this application should also be included within the protection scope of this application and are hereby incorporated herein by reference.

[0061] Based on the above Figure 1 shown implementation environment, an embodiment of the present application provides a method for controlling the movement of a virtual object. Taking this method applied to the terminal 11 as an example. As Figure 2 shown, the method provided by the embodiment of the present application includes the following steps:

[0062] In step 201, in response to a movement instruction of a target virtual object, determine the target position information corresponding to the target virtual object and the radius of the target virtual object.

[0063] The embodiments of the present application are executed by a terminal, which is installed with an application program (referred to as the target application program) capable of providing a virtual environment. The terminal stores the terrain information of at least two virtual terrain units corresponding to the virtual environment provided by the target application program. In an exemplary embodiment, different virtual terrain units correspond to different planar regions, and the terrain information of any virtual terrain unit includes the height value of the virtual terrain grids constituting the any virtual terrain unit and the passable distance value of the virtual terrain grids constituting the any virtual terrain unit.

[0064] The terrain information of the virtual terrain unit is used to describe the virtual terrain in the virtual environment provided by the target application program. It should be noted that the virtual terrain refers to a fixed virtual terrain set during the development stage of the application program. The virtual terrain unit is composed of virtual terrain grids, and one virtual terrain unit corresponds to one planar region, and different virtual terrain units correspond to different planar regions. Each planar region corresponding to a virtual terrain unit refers to a small region obtained by dividing the entire ground plane region in the virtual environment. Exemplarily, the division method for dividing the entire ground plane region in the virtual environment is: dividing the entire ground plane region into multiple small regions with reference dimensions. In this case, the size of each planar region corresponding to a virtual terrain unit is the reference dimension. The reference dimension is set according to experience or flexibly adjusted according to the application scenario, and the embodiments of the present application do not limit this. Exemplarily, each planar region corresponding to a virtual terrain unit refers to a square planar region, and the reference dimension is the area of the square.

[0065] The virtual terrain unit is composed of virtual terrain grids, and the size of the virtual terrain grids constituting a certain virtual terrain unit is the same as the size of the planar region corresponding to the virtual terrain unit. In an exemplary embodiment, the sizes of the different planar regions corresponding to different virtual terrain units are all reference dimensions, so the sizes of the virtual terrain grids constituting different virtual terrain units are all reference dimensions. The embodiments of the present application take the sizes of the virtual terrain grids constituting different virtual terrain units as all reference dimensions as an example for description, but the embodiments of the present application are not limited thereto. In an exemplary embodiment, the sizes of the virtual terrain grids constituting different virtual terrain units may also be different.

[0066] The terrain information of any virtual terrain unit includes the height value of the virtual terrain grids constituting the any virtual terrain unit and the passable distance value of the virtual terrain grids constituting the any virtual terrain unit. It should be noted that the number of virtual terrain grids constituting any virtual terrain unit is one or more, and the embodiments of the present application do not limit this. When the number of virtual terrain grids constituting any virtual terrain unit is multiple, the terrain information of any virtual terrain unit includes the height values of the multiple virtual terrain grids constituting the any virtual terrain unit and the passable distance values of the multiple virtual terrain grids constituting the any virtual terrain unit.

[0067] The height value of a virtual terrain cell and the passable distance value of the virtual terrain cell are used to describe the virtual terrain cell. The height value of the virtual terrain cell is used to indicate the height position of the virtual terrain cell in the virtual environment. Exemplarily, the height value of the virtual terrain cell is represented by the z-axis coordinate in the spatial coordinate. That is to say, the height value of the virtual terrain cell may be a positive value, a negative value, or 0. The passable distance value of the virtual terrain cell is used to indicate the maximum movable range provided by the virtual terrain cell for the virtual object, and the passable distance value of the virtual terrain cell is a value not less than 0.

[0068] It should be noted that the terrain information of at least two virtual terrain units corresponding to the virtual environment is obtained in advance during the development of the target application. The terrain information of at least two virtual terrain units corresponding to the virtual environment stored in the terminal may be obtained by the terminal itself or by other terminals. The embodiments of the present application do not limit this. Exemplarily, for the case where the terminal is both the development terminal and the usage terminal of the target application, the terrain information of at least two virtual terrain units corresponding to the virtual environment stored in the terminal is obtained by the terminal itself; for the case where the terminal is only the usage terminal of the target application, the terrain information of at least two virtual terrain units corresponding to the virtual environment stored in the terminal is obtained by the development terminal of the target application.

[0069] After the development terminal of the target application obtains the terrain information of at least two virtual terrain units corresponding to the virtual environment, it publishes the terrain information of at least two virtual terrain units corresponding to the virtual environment and the target application to the server for serving the target application. The terminal stores the terrain information of at least two virtual terrain units locally by downloading and installing the target application from the server, and then directly realizes the movement control of the virtual object based on the terrain information of at least two virtual terrain units stored locally. The process of obtaining the terrain information of at least two virtual terrain units corresponding to the virtual environment will be introduced in the Figure 8 embodiment shown below and will not be elaborated here.

[0070] It should be further noted that since the terrain information of at least two virtual terrain units corresponding to the virtual environment is obtained in advance during the development of the target application, for each terminal installing the target application, the terrain information of at least two virtual terrain units corresponding to the virtual environment stored is the same, so that different terminals can perform the same movement control on the virtual object under the same operation instructions. Based on this, the method provided by the embodiments of the present application can be applied to game applications based on frame synchronization.

[0071] The terminal in the embodiments of the present application refers to any terminal installed with an application program (i.e., the target application program) that can provide a virtual environment. The terminal can implement the movement control of virtual objects based on the terrain information of at least two virtual terrain units corresponding to the stored virtual environment. In the process of implementing the movement control of virtual objects, the terminal first responds to the movement instruction of the target virtual object, determines the target position information corresponding to the target virtual object and the radius of the target virtual object, and then based on the target position information corresponding to the target virtual object, the radius of the target virtual object, and the terrain information of at least two virtual terrain units corresponding to the stored virtual environment, implements the movement control of the target virtual object.

[0072] The target virtual object refers to a virtual object that is active in the virtual environment and requires the terminal to perform movement control. The movement instruction of the target virtual object is used to indicate that the target virtual object needs to move. The embodiments of the present application do not limit the manner in which the terminal obtains the movement instruction of the target virtual object. Exemplarily, the target virtual object is the virtual object corresponding to the login account of the terminal, and the terminal obtains the movement instruction of the target virtual object by detecting the operation of the interaction object to move the target virtual object.

[0073] Exemplarily, the movement instruction of the target virtual object is forwarded by the server that provides background services for the target application program to the terminal. Thus, the terminal obtains the movement instruction of the target virtual object. It should be noted that for the case where the movement instruction of the target virtual object obtained by the terminal is forwarded by the server, the target virtual object may be other objects except the virtual object corresponding to the login account of the terminal, or may be the virtual object corresponding to the login account of the terminal. The embodiments of the present application do not limit this. That is, the terminal can perform movement control on any virtual object that is active in the virtual environment by obtaining the movement instruction.

[0074] After the terminal obtains the movement instruction of the target virtual object, it responds to the movement instruction of the target virtual object and determines the target position information corresponding to the target virtual object and the radius of the target virtual object. The target position information corresponding to the target virtual object is used to describe the position of the target virtual object in the virtual environment, and the radius of the target virtual object is used to describe the space occupied by the target virtual object in the virtual environment.

[0075] In some embodiments, the target position information corresponding to the target virtual object includes a target plane coordinate and a target height value. The target plane coordinate is used to indicate the plane coordinate corresponding to the position where the target virtual object is located in the virtual environment, and the target height value is used to indicate the height value corresponding to the position where the target virtual object is located in the virtual environment. Exemplarily, the position where the target virtual object is located in the virtual environment is represented by the spatial coordinate (x1, y1, z1). The target plane coordinate refers to (x1, y1), and the target height value refers to z1. The spatial coordinate (x1, y1, z1) is a coordinate in a spatial coordinate system. The plane where the x-axis and y-axis in the spatial coordinate system are located is parallel to the ground plane in the virtual environment, and the z-axis in the spatial coordinate system is perpendicular to the ground plane in the virtual environment. It should be noted that the target height value may be positive, negative, or zero, and the embodiments of the present application do not limit this.

[0076] In some embodiments, the position where the target virtual object is located in the virtual environment refers to the position where the reference point on the target virtual object is located in the virtual environment. The reference point is set according to experience or flexibly adjusted according to the application scenario. For example, the reference point refers to the center point on the line connecting the two feet of the target virtual object. The terminal can determine the target position information corresponding to the target virtual object according to the position where the reference point on the target virtual object is located in the virtual environment when obtaining the movement instruction of the target virtual object.

[0077] In some embodiments, the radius of the virtual object is an attribute parameter of the virtual object. The radii of different virtual objects may be the same or different. In an exemplary embodiment, the radius of the target virtual object is carried in the attribute information of the target virtual object. The terminal can automatically extract the radius of the target virtual object from the attribute information of the target virtual object in response to the movement instruction of the target virtual object. In an exemplary embodiment, the correspondence between the virtual object identifier and the radius is stored in the terminal. The terminal can query the radius of the target virtual object according to the virtual object identifier of the target virtual object in the correspondence between the virtual object identifier and the radius in response to the movement instruction of the target virtual object. The virtual object identifier of the target virtual object is used to identify the target virtual object. For example, the virtual object identifier of the target virtual object is the name of the target virtual object, the ID (Identity Document) corresponding to the target virtual object, etc.

[0078] In step 202, based on the target position information and the terrain information of at least two virtual terrain units, determine the target passable distance value corresponding to the target virtual object.

[0079] After determining the target position information corresponding to the target virtual object, based on the target position information and the terrain information of at least two stored virtual terrain units, determine the target passable distance value corresponding to the target virtual object. The target passable distance value is used to indicate the maximum movable range of the target virtual object and can be used to measure whether the target virtual object can continue to move in the original moving direction.

[0080] The terrain information of at least two virtual terrain units is used to describe the fixed virtual terrain in the virtual environment provided by the target application. During the operation of the target application, dynamic obstacles may appear. A dynamic obstacle refers to an obstacle that appears irregularly during the operation of the target application. When a movement instruction of the target virtual object is obtained, there may or may not be a target dynamic obstacle in the virtual environment. A target dynamic obstacle refers to a dynamic obstacle that may hinder the movement of the target virtual object.

[0081] In an exemplary embodiment, the height value corresponding to the bottom surface and the height value corresponding to the top surface of the dynamic obstacle form a height value region corresponding to the dynamic obstacle. A target dynamic obstacle refers to a dynamic obstacle whose corresponding height value interval has an intersection with the reference height value interval corresponding to the target virtual object. The lower bound of the reference height value interval is the sum of the height value corresponding to the feet of the target virtual object and the maximum height of the obstacle that the target virtual object can cross, and the upper bound of the reference height value interval is the height value corresponding to the head of the target virtual object. The maximum height of the obstacle that the target virtual object can cross may be related to the type of the target virtual object or may be a fixed parameter provided by the target application. The embodiments of the present application do not limit this.

[0082] In a possible implementation manner, the implementation process of step 202 includes the following steps 2021 to 2023:

[0083] Step 2021: Based on the target plane coordinates and the plane regions respectively corresponding to at least two virtual terrain units, determine the target virtual terrain unit among at least two virtual terrain units.

[0084] Based on the target plane coordinates and the plane regions respectively corresponding to at least two virtual terrain units, it is possible to determine which plane region corresponding to a virtual terrain unit the target plane coordinates are in, and then use this virtual terrain unit as the target virtual terrain unit.

[0085] Step 2022: Based on the target height value and the height values of the virtual terrain grids that make up the target virtual terrain unit, determine the target virtual terrain grid among the virtual terrain grids that make up the target virtual terrain unit.

[0086] After determining the target virtual terrain unit, the height values of the virtual terrain grids that make up the target virtual terrain unit can be determined based on the terrain information of the target virtual terrain unit. Then, the target height value can be compared with the height values of the virtual terrain grids that make up the target virtual terrain unit, and the virtual terrain grids corresponding to the height values that meet the selection conditions among the virtual terrain grids that make up the target virtual terrain unit are used as the target virtual terrain grids. Exemplarily, the height value that meets the selection condition refers to the height value that is closest to the target height value.

[0087] Step 2023: Based on the target virtual terrain grid, determine the target passable distance value corresponding to the target virtual object.

[0088] The target virtual terrain grid can be regarded as the virtual terrain grid where the target virtual object is currently located. Based on the target virtual terrain grid, the target passable distance value corresponding to the target virtual object can be determined. In a possible implementation manner, in the case where there is no target dynamic obstacle in the virtual environment, the process of determining the target passable distance value corresponding to the target virtual object based on the target virtual terrain grid refers to the process of directly determining the target passable distance value corresponding to the target virtual object based on the target virtual terrain grid, and this process includes the following steps a and b:

[0089] Step a: Determine the first adjacent virtual terrain grids corresponding to the target virtual terrain grid.

[0090] The first adjacent virtual terrain grids refer to the virtual terrain grids that meet the first adjacent condition with the target virtual terrain grid in the virtual terrain where the target virtual terrain grid is located. Exemplarily, meeting the first adjacent condition means being adjacent to the target virtual terrain grid in the four corner directions of the target virtual terrain grid. That is to say, the first adjacent virtual terrain grids include the four corner adjacent virtual terrain grids corresponding to the target virtual terrain grid. Exemplarily, the four corner adjacent virtual terrain grids included in the first adjacent virtual terrain grids are respectively called the lower left corner adjacent virtual terrain grid, the lower right corner adjacent virtual terrain grid, the upper right corner adjacent virtual terrain grid, and the upper left corner adjacent virtual terrain grid.

[0091] For example, the positional relationship between the target virtual terrain grid and the first adjacent virtual terrain grids is as Figure 3 shown. The four corner adjacent virtual terrain grids included in the first adjacent virtual terrain grids corresponding to the target virtual terrain grid 301 are respectively the lower left corner virtual terrain grid 302, the lower right corner virtual terrain grid 303, the upper right corner virtual terrain grid 304, and the upper left corner virtual terrain grid 305. It should be noted that Figure 3The numerical value marked in the shown virtual terrain grid is the passable distance value of the virtual terrain grid. For example, the passable distance value of the target virtual terrain grid 301 is 2. The black dot in the target virtual terrain grid 301 represents the target virtual object.

[0092] In a possible implementation manner, the method for determining the first adjacent virtual terrain grids corresponding to the target virtual terrain grid is as follows: taking the plane area where the target plane coordinates are located as the reference plane area, determining four corner adjacent virtual terrain units corresponding to four plane areas adjacent to the reference plane area in the four corner directions of the reference plane area; taking the virtual terrain grids corresponding to the height values closest to the target height value in the virtual terrain grids that make up each corner adjacent virtual terrain unit as a corner adjacent virtual terrain grid; after obtaining the four corner adjacent virtual terrain grids, obtaining the first adjacent virtual terrain grids corresponding to the target virtual terrain grid.

[0093] Step b: Based on the passable distance values of the first adjacent virtual terrain grids and the distances between the target plane coordinates and the reference boundaries of the target plane area, determine the target passable distance value corresponding to the target virtual object. Wherein, the target plane area is the plane area corresponding to the target virtual terrain unit.

[0094] The passable distance values of the first adjacent virtual terrain grids refer to the passable distance values respectively corresponding to the four corner adjacent virtual terrain grids included in the first adjacent virtual terrain grids. The passable distance values respectively corresponding to the four corner adjacent virtual terrain grids can be determined according to the terrain information of the virtual terrain units respectively formed by the four corner adjacent virtual terrain grids.

[0095] The target plane area is the plane area corresponding to the target virtual terrain unit. The reference boundaries of the target plane area are preset according to experience. Exemplarily, the reference boundaries of the target plane area refer to the left boundary and the lower boundary of the target plane area. The distances between the target plane coordinates and the reference boundaries of the target plane area include the distance between the target plane coordinates and the left boundary of the target plane area and the distance between the target plane coordinates and the lower boundary of the target plane area. Since the target plane coordinates are within the target plane area, the distances between the target plane coordinates and the reference boundaries of the target plane area can be directly determined.

[0096] In a possible implementation manner, the process of determining the target passable distance value corresponding to the target virtual object based on the passable distance values of the first adjacent virtual terrain grids and the distances between the target plane coordinates and the reference boundaries of the target plane area is implemented using formula 1:

[0097] y = y0 + (y1 - y0)U + (y3 - y0)V + (y2 - y3 - y1 + y0)UV (formula 1)

[0098] Among them, y represents the target passable distance value corresponding to the target virtual object; y0 represents the passable distance value of the lower-left adjacent virtual terrain grid included in the first adjacent virtual terrain grid; y1 represents the passable distance value of the lower-right adjacent virtual terrain grid included in the first adjacent virtual terrain grid; y2 represents the passable distance value of the upper-right adjacent virtual terrain grid included in the first adjacent virtual terrain grid; y3 represents the passable distance value of the upper-left adjacent virtual terrain grid included in the first adjacent virtual terrain grid; U represents the distance between the target plane coordinate and the left boundary of the target plane area; V represents the distance between the target plane coordinate and the lower boundary of the target plane area.

[0099] It should be noted that the above steps a and b only describe an exemplary implementation method for directly determining the target passable distance value corresponding to the target virtual object based on the target virtual terrain grid. The embodiments of the present application are not limited thereto. In an exemplary embodiment, the method for directly determining the target passable distance value corresponding to the target virtual object based on the target virtual terrain grid is: using the passable distance value of the target virtual terrain grid as the target passable distance value corresponding to the target virtual object.

[0100] In a possible implementation manner, in the case where there is a target dynamic obstacle in the virtual environment, the process of determining the target passable distance value corresponding to the target virtual object based on the target virtual terrain grid refers to the process of determining the target passable distance value corresponding to the target virtual object based on the target virtual terrain grid and the target dynamic obstacle. This process includes the following steps A to C:

[0101] Step A: Determine the first passable distance value corresponding to the target virtual object based on the target virtual terrain grid.

[0102] For the implementation process of this step A, refer to the above process of determining the target passable distance value corresponding to the target virtual object according to steps a and b, which will not be elaborated here.

[0103] Since there is a target dynamic obstacle in the virtual environment, in the process of determining the target passable distance value corresponding to the target virtual object, in addition to considering the terrain information of at least two virtual terrain units stored in advance, it is also necessary to consider the target dynamic obstacle to improve the accuracy of the determined target passable distance value, and further improve the accuracy of the terminal's movement control of the target virtual object.

[0104] Step B: Determine the second passable distance value corresponding to the target virtual object based on the target plane coordinate and the plane projection of the target dynamic obstacle.

[0105] The planar projection of the target dynamic obstacle refers to the projection of the target dynamic obstacle on the ground plane in the virtual environment. It should be noted that the number of target dynamic obstacles is one or more, and the embodiments of the present application do not limit this. When the number of target dynamic obstacles is multiple, based on the target plane coordinates and the planar projection of each target dynamic obstacle, a second passable distance value corresponding to the target virtual object is determined. That is to say, the number of second passable distance values corresponding to the target virtual object is the same as the number of target dynamic obstacles. The embodiments of the present application will be described by taking the number of target dynamic obstacles as one as an example.

[0106] In a possible implementation manner, the planar projection of the target dynamic obstacle is a target disk. In this case, the target dynamic obstacle is a cylindrical obstacle with a bottom surface parallel to the ground plane in the virtual environment. When the planar projection of the target dynamic obstacle is a target disk, the method for determining the second passable distance value corresponding to the target virtual object based on the target plane coordinates and the planar projection of the target dynamic obstacle is as follows: calculate the first distance between the planar coordinates of the disk center of the target disk and the target plane coordinates; take the difference between the first distance and the radius of the target disk as the second passable distance value corresponding to the target virtual object.

[0107] Exemplarily, as Figure 4 shown, the planar coordinates of the disk center of the target disk correspond to point c, the target plane coordinates correspond to point x, and the radius of the target disk is r. Then, when the planar projection of the target dynamic obstacle is a target disk, the second passable distance value corresponding to the target virtual object is calculated using formula 2:

[0108] Φ(x) = ||x - c|| - r (formula 2)

[0109] where Φ(x) represents the second passable distance value corresponding to the target virtual object; x represents the vector corresponding to point x; c represents the vector corresponding to point c; ||x - c|| represents the first distance between the planar coordinates of the disk center of the target disk and the target plane coordinates.

[0110] In a possible implementation manner, the planar projection of the target dynamic obstacle is a target rectangle. In this case, the target dynamic obstacle is a cuboid-shaped obstacle with the upper and lower surfaces parallel to the ground plane in the virtual environment. When the planar projection of the target dynamic obstacle is a target rectangle, the method for determining the second passable distance value corresponding to the target virtual object based on the target plane coordinates and the planar projection of the target dynamic obstacle is as follows: determine the second passable distance value corresponding to the target virtual object based on the target plane coordinates, the planar coordinates of the rectangle center of the target rectangle, the steering angle corresponding to the target rectangle, and the boundary distance corresponding to the rectangle center of the target rectangle.

[0111] The steering angle corresponding to the target rectangle refers to the steering angle of the target rectangle relative to the z-axis of the spatial coordinate system, where the z-axis is the coordinate axis perpendicular to the ground plane in the virtual environment. The boundary distance corresponding to the rectangle center of the target rectangle refers to the distances from the rectangle center of the target rectangle to two adjacent boundaries of the target rectangle. In a possible implementation, as Figure 5 shown, the plane coordinate corresponding point c of the rectangle center of the target rectangle, the target plane coordinate corresponding point x, the steering angle corresponding to the target rectangle is θ, and the boundary distances corresponding to the rectangle center of the target rectangle are b1 and b2. The process of determining the second passable distance value corresponding to the target virtual object is implemented using Equation 3 based on the target plane coordinate, the plane coordinate of the rectangle center of the target rectangle, the steering angle corresponding to the target rectangle, and the boundary distances corresponding to the rectangle center of the target rectangle:

[0112]

[0113] where x represents the vector corresponding to point x; c represents the vector corresponding to point c; (x - c)R(-θ) represents the vector obtained by rotating the vector from point x to point c counterclockwise by θ; b represents the vector composed of the boundary distances b1 and b2, b = (b1, b2); d represents the vector calculated according to the first equation in Equation 3, and the vector d is represented in the form of two-dimensional coordinates; Φ(x) represents the second passable distance value corresponding to the target virtual object; d x represents the abscissa in the two-dimensional coordinates corresponding to the vector d; d y represents the ordinate in the two-dimensional coordinates corresponding to the vector d; max(d, 0) represents the vector corresponding to the two-dimensional coordinates composed of the maximum abscissa and the maximum ordinate, where the maximum abscissa is the maximum value between the abscissa in the two-dimensional coordinates corresponding to the vector d and 0, and the maximum ordinate is the maximum value between the ordinate in the two-dimensional coordinates corresponding to the vector d and 0.

[0114] In the process of determining the second passable distance value corresponding to the target virtual object based on Equation 3, first transform the target plane coordinate of the target virtual object into the local coordinate system of the target rectangle, and then calculate the second passable distance value corresponding to the target virtual object.

[0115] Step C: Use the minimum value between the first passable distance value and the second passable distance value as the target passable distance value corresponding to the target virtual object.

[0116] After determining the first passable distance value and the second passable distance value corresponding to the target virtual object, the minimum value among the first passable distance value and the second passable distance value is used as the target passable distance value corresponding to the target virtual object. Exemplarily, the first passable distance value determined by considering the terrain information of at least two pre-stored virtual terrain units is denoted as SDF0, and the second passable distance value determined by considering the target dynamic obstacle is denoted as Φ(x). Then the target passable distance value SDF corresponding to the target virtual object is expressed as: SDF = min(Φ(x), SDF0). It should be noted that for the case where there are multiple target dynamic obstacles, the number of second passable distance values is multiple, and the target passable distance value SDF is expressed as: SDF = min(Φ(x)1, Φ(x)2, …, Φ(x) n , SDF0), where n (n is an integer not less than 2) represents the number of second passable distance values.

[0117] In either case, the target passable distance value corresponding to the target virtual object can be determined, and then it is judged whether the target passable distance value is greater than the radius of the target virtual object. If the target passable distance value is not greater than the radius of the target virtual object, it means that the target virtual object cannot continue to move in the original moving direction of the target virtual object. At this time, step 203 is executed. If the target passable distance value is greater than the radius of the target virtual object, it means that the target virtual object can continue to move in the original moving direction of the target virtual object. In this case, the terminal controls the target virtual object to move in the original moving direction. The original moving direction of the target virtual object refers to the moving direction of the target virtual object when the moving instruction of the target virtual object is obtained.

[0118] For example, as Figure 3 shown, assume that the target passable distance value SDF corresponding to the target virtual object is 1.8, and the radius of the target virtual object = 0.5, which means that the target virtual object can move in the original moving direction, that is, the target virtual object can continue to walk.

[0119] In the exemplary embodiment, the terminal controlling the target virtual object to move in the original moving direction means that the terminal controls the target virtual object to move in the original moving direction in a first reference moving manner. The first reference moving manner is used to indicate the moving speed, moving time, etc. of the target virtual object, and the first reference moving manner is determined according to the actual scene and is not limited here.

[0120] In step 203, in response to the target passable distance value not being greater than the radius of the target virtual object, based on the original moving direction of the target virtual object, a new moving direction of the target virtual object is determined, and the target virtual object is controlled to move in the new moving direction.

[0121] When the target passable distance value is not greater than the radius of the target virtual object, it indicates that the target virtual object cannot continue to move in its original moving direction. At this time, a new moving direction needs to be determined, and then the target virtual object is controlled to move in the new moving direction. By controlling the target virtual object to move in the new moving direction, the target virtual object can move smoothly around the terrain edge or obstacle, improving the accuracy of the movement control of the virtual object, reducing the visual abruptness of the movement of the virtual object, and enhancing the user experience.

[0122] In a possible implementation, the process of determining the new moving direction of the target virtual object based on the original moving direction of the target virtual object includes the following steps 2031 and 2032:

[0123] Step 2031: Determine the gradient direction corresponding to the target virtual object.

[0124] The gradient direction corresponding to the target virtual object is used to indicate the direction in which the movement of the target virtual object will not be blocked. In a possible implementation, the process of determining the gradient direction corresponding to the target virtual object includes the following steps I to III:

[0125] Step I: Determine the target virtual terrain grid corresponding to the target virtual object.

[0126] For the implementation of this step I, refer to steps 2021 and 2022, which will not be elaborated here.

[0127] Step II: Determine the second adjacent virtual terrain grids corresponding to the target virtual terrain grid.

[0128] The second adjacent virtual terrain grids refer to the virtual terrain grids in the virtual terrain where the target virtual terrain grid is located that satisfy the second adjacent condition with the target virtual terrain grid. Exemplarily, satisfying the second adjacent condition means being adjacent to the target virtual terrain grid in the directions of the four boundaries of the target virtual terrain grid. That is to say, the second adjacent virtual terrain grids include the four boundary adjacent virtual terrain grids corresponding to the target virtual terrain grid. Exemplarily, the four boundary adjacent virtual terrain grids included in the second adjacent virtual terrain grids are respectively called the upper boundary adjacent virtual terrain grid, the lower boundary adjacent virtual terrain grid, the left boundary adjacent virtual terrain grid, and the right boundary adjacent virtual terrain grid.

[0129] In a possible implementation manner, the method for determining the second adjacent virtual terrain grid corresponding to the target virtual terrain grid is as follows: taking the plane area where the target plane coordinates are located as the reference plane area, determining four boundary adjacent virtual terrain units corresponding to four plane areas adjacent to the reference plane area in the directions of the four boundaries of the reference plane area; taking the virtual terrain grids corresponding to the height values closest to the target height value among the virtual terrain grids that make up each boundary adjacent virtual terrain unit as a boundary adjacent virtual terrain grid; after obtaining the four boundary adjacent virtual terrain grids, obtaining the second adjacent virtual terrain grid corresponding to the target virtual terrain grid.

[0130] Step III: Based on the passable distance values of the second adjacent virtual terrain grids, determine the gradient direction corresponding to the target virtual object.

[0131] The passable distance value of the second adjacent virtual terrain grid refers to the passable distance values corresponding to the four boundary adjacent virtual terrain grids included in the second adjacent virtual terrain grid. The passable distance values corresponding to the four boundary adjacent virtual terrain grids can be determined according to the terrain information of the virtual terrain units formed by the four boundary adjacent virtual terrain grids respectively.

[0132] After determining the second adjacent virtual terrain grid, based on the passable distance values of the second adjacent virtual terrain grids, determine the gradient direction corresponding to the target virtual object. In a possible implementation manner, the process of determining the gradient direction corresponding to the target virtual object based on the passable distance values of the second adjacent virtual terrain grids is as follows: based on the passable distance values corresponding to the four boundary adjacent virtual terrain grids included in the second adjacent virtual terrain grid, determine the gradient vector corresponding to the target virtual object; taking the direction of the gradient vector corresponding to the target virtual object as the gradient direction corresponding to the target virtual object.

[0133] The gradient vector corresponding to the target virtual object is represented in the form of two-dimensional coordinates. The process of determining the gradient vector corresponding to the target virtual object is the process of determining the abscissa and ordinate in the two-dimensional coordinates used to represent the gradient vector corresponding to the target virtual object. For example, the gradient vector corresponding to the target virtual object is represented by Formula 4:

[0134]

[0135] Where represents the gradient vector corresponding to the target virtual object; represents the abscissa in the two-dimensional coordinates used to represent the gradient vector corresponding to the target virtual object; represents the ordinate in the two-dimensional coordinates used to represent the gradient vector corresponding to the target virtual object.

[0136] In a possible implementation manner, the method for determining the gradient vector corresponding to the target virtual object based on the passable distance values respectively corresponding to the four boundary adjacent virtual terrain grids included in the second adjacent virtual terrain grid is as follows: taking the difference between the passable distance value corresponding to the right boundary adjacent virtual terrain grid and the passable distance value corresponding to the left boundary adjacent virtual terrain grid as the abscissa in the two-dimensional coordinates representing the gradient vector corresponding to the target virtual object; taking the difference between the passable distance value corresponding to the upper boundary adjacent virtual terrain grid and the passable distance value corresponding to the lower boundary adjacent virtual terrain grid as the ordinate in the two-dimensional coordinates representing the gradient vector corresponding to the target virtual object. After obtaining the abscissa and ordinate in the two-dimensional coordinates representing the gradient vector corresponding to the target virtual object, the gradient vector corresponding to the target virtual object can be obtained. After determining the gradient vector corresponding to the target virtual object, taking the direction of the gradient vector as the gradient direction, and then performing step 2032.

[0137] Step 2032: Determine the new movement direction of the target virtual object based on the gradient direction and the original movement direction of the target virtual object.

[0138] In a possible implementation manner, the process of determining the new movement direction of the target virtual object based on the gradient direction and the original movement direction of the target virtual object is implemented using formula 5:

[0139]

[0140] where v′ represents the new movement direction of the target virtual object; v represents the original movement direction of the target virtual object; represents the gradient direction. For example, an exemplary relationship between the new movement direction v′, the original movement direction v, and the gradient direction is as Figure 6 shown.

[0141] After determining the new movement direction of the target virtual object, the terminal controls the target virtual object to move according to the new movement direction. In an exemplary embodiment, the terminal controlling the target virtual object to move according to the new movement direction means that the terminal controls the target virtual object to move in the new movement direction in a second reference movement manner. The second reference movement manner may be the same as or different from the first reference movement manner, which is related to the actual scenario, and the embodiments of the present application do not limit this.

[0142] In a possible implementation, during the process of the terminal controlling the target virtual object to move in a new moving direction, after a moving unit time, the new position information corresponding to the target virtual object is determined, and then the new passable distance value is determined according to the new position information. If the new passable distance value is greater than the radius of the target virtual object, the movement continues in the new moving direction; if the new passable distance value is not greater than the radius of the target virtual object, the terminal controls the target virtual object to move along the gradient direction.

[0143] The method provided by the embodiments of the present application can be applied to game applications based on frame synchronization. Based on the method provided by the embodiments of the present application, the movement of virtual objects in a multi-layer virtual terrain can be realized. For example, as Figure 7 shown, the virtual environment includes two layers of virtual terrain. The first layer of virtual terrain 701 is an arc-shaped terrain, and the second layer of virtual terrain 702 is a slope and a platform connected to the end of the slope. The interaction object can operate the virtual object on the terminal through a joystick. Based on the operation of the interaction object, the terminal can control the virtual object to walk on the first layer of virtual terrain 701, can also control the virtual object to walk onto the second layer of virtual terrain 702 through the slope, and can also control the virtual object to move smoothly on the arc edge. In this movement control mode, multi-layer virtual terrain is supported and smooth movement on the edge is supported, making the movement control of the terminal have high performance.

[0144] In the embodiments of the present application, the terminal stores the terrain information of at least two virtual terrain units corresponding to the virtual environment. Compared with storing voxel data, storing terrain information is beneficial to saving storage space, thereby improving the movement control performance of virtual objects; in addition, on the basis of pre-storing the terrain information of the virtual terrain units, when it is determined that the virtual object cannot continue to move in the original moving direction, a new moving direction is determined and the virtual object is controlled to move in the new moving direction, so that the accuracy of the movement control of the virtual object is relatively high.

[0145] The embodiments of the present application provide a method for obtaining the terrain information of at least two virtual terrain units corresponding to a virtual environment. Taking the development terminal of a target application program to which this method is applied as an example, this development terminal may be the same terminal as the terminal executing the Figure 2 embodiment shown, or may be a different terminal from the terminal executing the Figure 2 embodiment shown. The embodiments of the present application do not limit this. As Figure 8 shown, the method provided by the embodiments of the present application includes the following steps:

[0146] In step 801, ray detection is performed on the virtual terrain in the virtual environment to obtain the height value information of at least two virtual terrain units corresponding to the virtual environment. The height value information of any virtual terrain unit includes the height values of the virtual terrain grids that make up any virtual terrain unit.

[0147] The development terminal is used to obtain the terrain information of at least two virtual terrain units corresponding to the virtual environment provided by the target application before releasing the target application. The terrain information of any virtual terrain unit includes altitude value information and passable distance value information. In step 801, the development terminal obtains the altitude value information of at least two virtual terrain units; in step 802, the development terminal obtains the passable distance value information of at least two virtual terrain units.

[0148] The altitude value information of any virtual terrain unit includes the altitude values of the virtual terrain grids that make up any virtual terrain unit. That is to say, the process of obtaining the altitude value information of at least two virtual terrain units is the process of obtaining the altitude values of all the virtual terrain grids that make up at least two virtual terrain units.

[0149] In the embodiment of the present application, the development terminal obtains the altitude value information of at least two virtual terrain units corresponding to the virtual environment by performing ray detection on the virtual terrain in the virtual environment. It should be noted that the virtual terrain in the virtual environment refers to the virtual terrain pre-set by the developer according to the application requirements of the target application. The embodiment of the present application does not limit the number of layers of the virtual terrain. The virtual environment may only include one layer of virtual terrain or may include multiple layers of virtual terrain.

[0150] In a possible implementation manner, the process of performing ray detection on the virtual terrain in the virtual environment to obtain the altitude value information of at least two virtual terrain units corresponding to the virtual environment is as follows: divide the complete ground plane in the virtual environment into multiple plane regions of a reference size, each plane region corresponds to a virtual terrain unit, and the distance between the region centers of two adjacent plane regions with adjacent boundaries is a reference distance, and the reference distance is determined according to the reference size; emit rays from top to bottom at intervals according to the reference distance, and determine the altitude value information of at least two virtual terrain units according to the altitude values of the contact points of the rays with each layer of the virtual terrain.

[0151] For any ray, the altitude value of the contact point of the ray with each layer of the virtual terrain is the altitude value of the virtual terrain grid that makes up the virtual terrain unit corresponding to the plane region pointed to by the ray. The number of virtual terrain grids that make up the virtual terrain unit corresponding to the plane region pointed to by the ray is the same as the number of contact points of the ray with each layer of the virtual terrain. In an exemplary embodiment, one contact point corresponds to the center of one virtual terrain grid, and the size of the virtual terrain grid is the same as the reference size corresponding to the plane region.

[0152] In an exemplary embodiment, according to the height values of the contact points of all the rays with the same layer of virtual terrain, the height values of all the virtual terrain grids in that layer of virtual terrain can be determined. According to the height values of all the virtual terrain grids in each layer of virtual terrain, the height value information of at least two virtual terrain units can be obtained.

[0153] For example, as Figure 9 shown, assume that the virtual environment includes two layers of virtual terrain, and the rays emitted from top to bottom have multiple contact points with these two layers of virtual terrain. According to the height values of the contact points, the height values of the virtual terrain grids in different layers of virtual terrain can be obtained. For example, the height values of the virtual terrain grids in virtual terrain 901 are as shown in 903, and the height values of the virtual terrain grids in virtual terrain 902 are as shown in 904. In 903 and 904, the numerical values marked in the virtual terrain grids represent height values.

[0154] It should be noted that a certain virtual terrain grid in virtual terrain 901 and the virtual terrain grid in virtual terrain 902 corresponding to the same planar area as this virtual terrain grid constitute the same virtual terrain unit. For example, the virtual terrain grid A in virtual terrain 901 and the virtual terrain grid B in virtual terrain 902 corresponding to the same planar area as this virtual terrain grid A constitute the same virtual terrain unit. The height value z of virtual terrain grid A A is 3, and the traversable distance value SDF A is to be determined; the height value z of virtual terrain grid B B is 1.3, and the traversable distance value SDF B is to be determined.

[0155] In a possible implementation manner, for the case where the target application is an application developed using the UE4 (Unreal Engine 4) engine, by calling the UWorld::LineTraceMultiByObjectType() method provided by UE4 to obtain FHitResult.ImpactPoint, the height value information of at least two virtual terrain units corresponding to the virtual environment can be obtained.

[0156] In step 802, for any one of the at least two virtual terrain units, based on the height value information of any one of the virtual terrain units, the traversable distance value information of any one of the virtual terrain units is obtained. The traversable distance value information of any one of the virtual terrain units includes the traversable distance values of the virtual terrain grids that make up any one of the virtual terrain units.

[0157] Since the terrain information of a virtual terrain unit includes altitude value information and traversable distance value information, after obtaining the altitude value information of the virtual terrain information, it is necessary to further obtain the traversable distance value information of the virtual terrain unit. The traversable distance value information of any virtual terrain unit is obtained based on the altitude value information of any virtual terrain unit. The process of obtaining the traversable distance value information of any virtual terrain unit is the process of obtaining the traversable distance values of the virtual terrain grids that make up the any virtual terrain unit. The traversable distance value of any virtual terrain grid that makes up the any virtual terrain unit is determined according to the altitude value of the any virtual terrain grid.

[0158] In a possible implementation, the process of obtaining the traversable distance value of any virtual terrain grid that makes up any virtual terrain unit includes the following steps 8021 and 8022:

[0159] Step 8021: For any virtual terrain grid that makes up any virtual terrain unit, based on the altitude value of the any virtual terrain grid, determine the first altitude value interval corresponding to the any virtual terrain grid and the second altitude value interval corresponding to the any virtual terrain grid.

[0160] The first altitude value interval corresponding to any virtual terrain grid and the second altitude value interval corresponding to any virtual terrain grid are determined according to the altitude value of the any virtual terrain grid. In a possible implementation, the implementation process of determining the first altitude value interval corresponding to any virtual terrain grid is: taking the sum of the altitude value of the any virtual terrain grid and the first parameter as the first lower bound; taking the sum of the altitude value of the any virtual terrain grid and the second parameter as the first upper bound; taking the altitude value interval formed by the first lower bound and the first upper bound and corresponding to the any virtual terrain grid as the first altitude value interval corresponding to the any virtual terrain grid.

[0161] Among them, the first parameter is used to indicate the maximum height of the obstacle that the virtual object can cross, and the second parameter is used to indicate the height of the virtual object. Both the first parameter and the second parameter are set by the developer according to experience and are the same for different virtual terrain grids. The altitude value interval formed by the first lower bound and the first upper bound and corresponding to any virtual terrain grid refers to the altitude value interval formed by the first lower bound and the first upper bound and located on the vertical line of the ground plane where the grid center of the any virtual terrain grid is located. The vertical line of the ground plane refers to the straight line perpendicular to the ground plane in the virtual environment.

[0162] In a possible implementation, the process of determining the second height value range corresponding to any virtual terrain grid is as follows: The difference between the height value of any virtual terrain grid and the third parameter is used as the second lower bound; the height value of any virtual terrain grid is used as the second upper bound; the height value range formed by the second lower bound and the second upper bound and corresponding to any virtual terrain grid is used as the second height value range corresponding to any virtual terrain grid.

[0163] Among them, the third parameter is used to indicate the maximum virtual cliff height that the virtual object can cross. The third parameter is set by the developer according to experience and is the same for different virtual terrain grids. The height value range formed by the second lower bound and the second upper bound and corresponding to any virtual terrain grid refers to the height value range formed by the second lower bound and the second upper bound and located on the vertical line of the ground plane where the grid center of any virtual terrain grid is located.

[0164] In an exemplary embodiment, TerrainMaxUpStep is used to represent the first parameter, that is, TerrainMaxUpStep is used to represent the maximum obstacle height that the virtual object can cross; ActorHeight is used to represent the second parameter, that is, ActorHeight is used to represent the height of the virtual object; TerrainMaxDownStep is used to represent the third parameter, that is, TerrainMaxDownStep is used to represent the maximum virtual cliff height that the virtual object can cross; Z is used to represent the height value corresponding to any virtual terrain grid. Based on this, the range formed by the first lower bound and the first upper bound is expressed as [Z + TerrainMaxUpStep, Z + ActorHeight], and the range formed by the second lower bound and the second upper bound is expressed as [Z - TerrainMaxDownStep, Z].

[0165] For example, as Figure 10 shown, the vertical line of the ground plane where the grid center of any virtual terrain grid is located is line L. The first height value range formed by the first lower bound and the first upper bound and corresponding to any virtual terrain grid is shown as 1001, and the second height value range formed by the second lower bound and the second upper bound and corresponding to any virtual terrain grid is used as the second height value range corresponding to any virtual terrain grid and is shown as 1002.

[0166] Step 8022: Perform a ray detection on the first height value range and the second height value range to determine the passable distance value of any virtual terrain grid.

[0167] After determining the first height value range and the second height value range corresponding to any virtual terrain grid, perform a ray detection on the first height value range and the second height value range to determine the passable distance value of the any virtual terrain grid.

[0168] In a possible implementation, the process of performing ray detection on the first height value interval and the second height value interval to determine the passable distance value of any virtual terrain grid includes the following three steps:

[0169] Step 1: Emit a first horizontal ray outward from the first height value interval, determine the ray length of the first horizontal ray, and use the minimum value among the ray lengths of the first horizontal ray as the first distance value corresponding to any virtual terrain grid.

[0170] The method of emitting the first horizontal ray outward from the first height value interval is as follows: within the first height value interval, determine a ray starting position every first height; emit a horizontal ray outward from each ray starting position. In this case, the first horizontal ray includes the horizontal rays emitted outward from each ray starting position. Exemplarily, the horizontal ray emitted outward from each ray starting position refers to an omnidirectional horizontal ray. The first height is set according to experience or flexibly adjusted according to the application scenario, and the embodiments of the present application do not limit this.

[0171] It should be noted that the horizontal ray terminates when it encounters an obstacle, and the ray length of the horizontal ray refers to the length between the ray starting position and the ray termination position. After emitting the first horizontal ray outward from the first height value interval, the ray length of the first horizontal ray can be determined, and then the minimum value among the ray lengths of the first horizontal ray is used as the first distance value corresponding to any virtual terrain grid.

[0172] Step 2: Emit a second horizontal ray from the outside to the second height interval, determine the horizontal distance between the termination position of the second horizontal ray and the grid center of any virtual terrain grid, and use the maximum value among the horizontal distances between the termination position of the second horizontal ray and the grid center of any virtual terrain grid as the second distance value corresponding to any virtual terrain grid.

[0173] The method of emitting the second horizontal ray from the outside to the second height interval is as follows: within the second height value interval, determine a ray target position every second height; emit a horizontal ray from the outside to each ray target position. In this case, the second horizontal ray includes the horizontal rays emitted from the outside to each ray target position. Exemplarily, the horizontal ray emitted from the outside to each ray target position refers to an omnidirectional horizontal ray. The second height is set according to experience or flexibly adjusted according to the application scenario, and the second height is the same as or different from the first height, and the embodiments of the present application do not limit this.

[0174] The ray will terminate when it hits an obstacle. After emitting a second horizontal ray from the outer side to the second height interval, the termination position of the second horizontal ray can be determined, and then the horizontal distance between the termination position of the second horizontal ray and the center of any virtual terrain grid can be determined. Then, the maximum value among the horizontal distances between the termination position of the second horizontal ray and the center of any virtual terrain grid is used as the second distance value corresponding to any virtual terrain grid.

[0175] Step 3: Use the minimum value between the first distance value and the second distance value as the passable distance value of any virtual terrain grid.

[0176] After determining the first distance value and the second distance value, use the minimum value between the first distance value and the second distance value as the passable distance value corresponding to any virtual terrain grid. Thus, the passable distance values of any virtual terrain grids that make up any virtual terrain unit are obtained.

[0177] Exemplarily, a two-dimensional schematic diagram of ray detection for the first height value interval and the second height value interval based on the above steps 1 to 3 is as Figure 10 shown, and a three-dimensional schematic diagram of ray detection for the first height value interval and the second height value interval based on the above steps 1 to 3 is as Figure 11 shown.

[0178] In another possible implementation, the process of performing ray detection on the first height value interval and the second height value interval and determining the passable distance value of any virtual terrain grid includes the following 4 steps:

[0179] 1. Emit a horizontal ray in the first reference direction from the first height value interval, and determine the minimum value UpSDF among the ray lengths of the horizontal rays in the first reference direction.

[0180] Among them, the first reference direction is set according to experience, and the embodiments of the present application do not limit this.

[0181] 2. Emit a horizontal ray in the second reference direction from the outer side to the second height value interval, and determine the maximum value DownSDF among the horizontal distances between the termination position of the horizontal ray in the second reference direction and the center of any virtual terrain grid.

[0182] Among them, the second reference direction is set according to experience. The second reference direction is the same as the first reference direction or different from the first reference direction, and the embodiments of the present application do not limit this.

[0183] 3. Use the minimum value between UpSDF and DownSDF as a candidate passable distance value for any virtual terrain grid. That is, take min(UpSDF, DownSDF) as a candidate passable distance value for any virtual terrain grid.

[0184] 4. In the angular range of [0, 360], rotate the horizontal ray. For each rotation of an angle, determine a new candidate passable distance value; take the minimum value among all the obtained candidate passable distance values as the passable distance value of any one of the virtual terrain cells.

[0185] It should be noted that during the process of rotating the horizontal ray, the horizontal ray is always perpendicular to the perpendicular line of the ground plane where the center of the cell of any one of the virtual terrain cells is located.

[0186] No matter which method is used, it is possible to determine the passable distance value of any one of the virtual terrain cells that make up any one of the virtual terrain units by performing ray detection on the first height value range and the second height value range. According to the method of determining the passable distance value of any one of the virtual terrain cells that make up any one of the virtual terrain units, it is possible to determine the passable distance values of all the virtual terrain cells that make up each virtual unit, and then obtain the passable distance value information of at least two virtual terrain units.

[0187] In step 803, based on the height value information of at least two virtual terrain units and the passable distance value information of at least two virtual terrain units, obtain the terrain information of at least two virtual terrain units corresponding to the virtual environment.

[0188] Since the terrain information of the virtual terrain unit includes the height value information of the virtual terrain cell and the passable distance value information of the virtual terrain cell, after obtaining the height value information of at least two virtual terrain units and the passable distance value information of at least two virtual terrain units, the terrain information of at least two virtual terrain units corresponding to the virtual environment can be obtained.

[0189] Exemplarily, assume that the virtual environment includes two layers of virtual terrain, and the passable distance values of the virtual terrain cells in these two layers of virtual terrain are respectively as Figure 12 shown in 1201 and 1202. Combining with Figure 9 the height values of the virtual terrain cells in the virtual terrain shown, the terrain information of the virtual terrain unit can be obtained. For example, combining Figure 9 and Figure 12 it can be known that the height value z A of the virtual terrain cell A in one layer of virtual terrain is 3, and the passable distance value SDF A is 1; the height value z B of the virtual terrain cell B in another layer of virtual terrain that forms the same virtual terrain unit as the virtual terrain cell A is 1.3, and the passable distance value SDF B is 2.

[0190] Based on the embodiments of the present application, an efficient terrain system can be implemented, which can be applied to game applications based on frame synchronization. When the method provided by the embodiments of the present application is applied to game applications based on frame synchronization, fixed-point number calculations are used in the process of implementing the terrain system. The method provided by the embodiments of the present application can support multi-layer terrain scenes, such as spiral scenes, etc., and can provide more possibilities for game play.

[0191] See Figure 13 , the embodiments of the present application provide a moving control device for virtual objects, and the device includes:

[0192] The first determination unit 1301 is configured to determine the target position information corresponding to the target virtual object and the radius of the target virtual object in response to a movement instruction of the target virtual object;

[0193] The second determination unit 1302 is configured to determine a target passable distance value corresponding to the target virtual object based on the target position information and the terrain information of at least two virtual terrain units;

[0194] The third determination unit 1303 is configured to, in response to the target passable distance value being not greater than the radius of the target virtual object, determine a new movement direction of the target virtual object based on the original movement direction of the target virtual object;

[0195] The control unit 1304 is configured to control the target virtual object to move in the new movement direction.

[0196] In a possible implementation manner, the target position information includes a target plane coordinate and a target height value. Different virtual terrain units correspond to different plane regions, and the terrain information of any virtual terrain unit includes the height values of the virtual terrain grids that make up any virtual terrain unit. The second determination unit 1302 is configured to determine a target virtual terrain unit among at least two virtual terrain units based on the target plane coordinate and the plane regions respectively corresponding to at least two virtual terrain units; determine a target virtual terrain grid among the virtual terrain grids that make up the target virtual terrain unit based on the target height value and the height values of the virtual terrain grids that make up the target virtual terrain unit; and determine a target passable distance value corresponding to the target virtual object based on the target virtual terrain grid.

[0197] In a possible implementation manner, the terrain information of any virtual terrain unit further includes the passable distance values of the virtual terrain grids that make up any virtual terrain unit. The second determination unit 1302 is further configured to determine first adjacent virtual terrain grids corresponding to the target virtual terrain grid; and determine a target passable distance value corresponding to the target virtual object based on the passable distance values of the first adjacent virtual terrain grids and the distance between the target plane coordinate and the reference boundary of the target plane region, where the target plane region is the plane region corresponding to the target virtual terrain unit.

[0198] In a possible implementation manner, there is a target dynamic obstacle in the virtual environment. The second determination unit 1302 is further configured to determine a first passable distance value corresponding to the target virtual object based on the target virtual terrain grid; determine a second passable distance value corresponding to the target virtual object based on the target plane coordinates and the planar projection of the target dynamic obstacle; and use the minimum value of the first passable distance value and the second passable distance value as the target passable distance value corresponding to the target virtual object.

[0199] In a possible implementation manner, the planar projection of the target dynamic obstacle is a target disk; the second determination unit 1302 is further configured to calculate a first distance between the planar coordinates of the disk center of the target disk and the target plane coordinates; and use the difference between the first distance and the radius of the target disk as the second passable distance value corresponding to the target virtual object.

[0200] In a possible implementation manner, the planar projection of the target dynamic obstacle is a target rectangle; the second determination unit is further configured to determine the second passable distance value corresponding to the target virtual object based on the target plane coordinates, the planar coordinates of the rectangle center of the target rectangle, the steering angle corresponding to the target rectangle, and the boundary distance corresponding to the rectangle center of the target rectangle.

[0201] In a possible implementation manner, the third determination unit 1303 is configured to determine the gradient direction corresponding to the target virtual object; and determine the new movement direction of the target virtual object based on the gradient direction and the original movement direction of the target virtual object.

[0202] In a possible implementation manner, referring to Figure 14 , the apparatus further includes:

[0203] The detection unit 1305 is configured to perform ray detection on the virtual terrain in the virtual environment to obtain height value information of at least two virtual terrain units corresponding to the virtual environment. The height value information of any virtual terrain unit includes the height value of the virtual terrain grid constituting any virtual terrain unit.

[0204] The acquisition unit 1306 is configured to, for any one of the at least two virtual terrain units, acquire passable distance value information of any one of the at least two virtual terrain units based on the height value information of any one of the at least two virtual terrain units. The passable distance value information of any virtual terrain unit includes the passable distance value of the virtual terrain grid constituting any virtual terrain unit.

[0205] The acquisition unit 1306 is further configured to obtain terrain information of at least two virtual terrain units corresponding to the virtual environment based on the height value information of the at least two virtual terrain units and the passable distance value information of the at least two virtual terrain units.

[0206] In a possible implementation, the obtaining unit 1306 is further configured to, for any virtual terrain grid that constitutes any virtual terrain unit, determine a first height value interval corresponding to any virtual terrain grid and a second height value interval corresponding to any virtual terrain grid based on the height value of any virtual terrain grid; perform ray detection on the first height value interval and the second height value interval to determine the passable distance value of any virtual terrain grid.

[0207] In a possible implementation, the obtaining unit 1306 is further configured to emit a first horizontal ray outward from the first height value interval, determine the ray length of the first horizontal ray, and use the minimum value in the ray lengths of the first horizontal ray as the first distance value corresponding to any virtual terrain grid; emit a second horizontal ray from the outside to the second height value interval, determine the horizontal distance between the termination position of the second horizontal ray and the grid center of any virtual terrain grid, and use the maximum value in the horizontal distances between the termination position of the second horizontal ray and the grid center of any virtual terrain grid as the second distance value corresponding to any virtual terrain grid; use the minimum value in the first distance value and the second distance value as the passable distance value of any virtual terrain grid.

[0208] In a possible implementation, the obtaining unit 1306 is further configured to use the sum of the height value of any virtual terrain grid and the first parameter as the first lower bound; use the sum of the height value of any virtual terrain grid and the second parameter as the first upper bound; use the height value interval formed by the first lower bound and the first upper bound and corresponding to any virtual terrain grid as the first height value interval corresponding to any virtual terrain grid; use the difference between the height value of any virtual terrain grid and the third parameter as the second lower bound; use the height value of any virtual terrain grid as the second upper bound; use the height value interval formed by the second lower bound and the second upper bound and corresponding to any virtual terrain grid as the second height value interval corresponding to any virtual terrain grid; where the first parameter is used to indicate the maximum height of an obstacle that a virtual object can cross, the second parameter is used to indicate the height of the virtual object, and the third parameter is used to indicate the maximum height of a virtual cliff that a virtual object can cross.

[0209] In a possible implementation, the control unit 1304 is further configured to, in response to the target passable distance value being greater than the radius of the target virtual object, control the target virtual object to move in the original moving direction.

[0210] In the embodiments of the present application, the terminal stores the terrain information of at least two virtual terrain units corresponding to the virtual environment. Compared with storing voxel data, storing terrain information helps save storage space and thus improve the movement control performance of virtual objects. In addition, on the basis of pre-storing the terrain information of the virtual terrain units, when it is determined that the virtual object cannot continue to move in the original movement direction, a new movement direction is determined and the virtual object is controlled to move in the new movement direction, so that the accuracy of the movement control of the virtual object is relatively high.

[0211] It should be noted that when the device provided in the above embodiments realizes its functions, only the above division of each functional module is used for illustration. In practical applications, the above functions can be allocated to different functional modules according to needs, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above. In addition, the device provided in the above embodiments and the method embodiments belong to the same concept, and the specific implementation process can be seen in the method embodiments, which will not be elaborated here.

[0212] Figure 15 FIG. is a schematic structural diagram of a terminal provided by an embodiment of the present application. Exemplarily, the terminal may be: a smart phone, a tablet computer, a notebook computer or a desktop computer. The terminal may also be referred to by other names such as user equipment, portable terminal, laptop terminal, desktop terminal, etc.

[0213] Generally, the terminal includes: a processor 1501 and a memory 1502.

[0214] The processor 1501 may include one or more processing cores, such as a quad-core processor, an octa-core processor, etc. The processor 1501 may be implemented in at least one hardware form of DSP (Digital Signal Processing), FPGA (Field-Programmable Gate Array), or PLA (Programmable Logic Array). The processor 1501 may also include a main processor and a coprocessor. The main processor is a processor for processing data in the wake state, also known as the CPU (Central Processing Unit); the coprocessor is a low-power processor for processing data in the standby state. In some embodiments, the processor 1501 may be integrated with a GPU (Graphics Processing Unit), and the GPU is responsible for rendering and drawing the content to be displayed on the display screen. In some embodiments, the processor 1501 may further include an AI (Artificial Intelligence) processor, and the AI processor is used to process computational operations related to machine learning.

[0215] The memory 1502 may include one or more computer-readable storage media, and the computer-readable storage media may be non-transitory. The memory 1502 may further include high-speed random access memory and non-volatile memory, such as one or more disk storage devices and flash storage devices. In some embodiments, the non-transitory computer-readable storage media in the memory 1502 is used to store at least one instruction, and the at least one instruction is used to be executed by the processor 1501 to implement the method for controlling the movement of virtual objects provided in the method embodiments of the present application.

[0216] In some embodiments, the terminal may optionally further include: a peripheral device interface 1503 and at least one peripheral device. The processor 1501, the memory 1502, and the peripheral device interface 1503 may be connected through a bus or signal lines. Each peripheral device may be connected to the peripheral device interface 1503 through a bus, signal lines, or a circuit board. Specifically, the peripheral devices include at least one of a radio frequency circuit 1504, a display screen 1505, a camera unit 1506, an audio circuit 1507, and a power supply 1509.

[0217] The peripheral device interface 1503 can be used to connect at least one I / O (Input / Output) related peripheral device to the processor 1501 and the memory 1502. In some embodiments, the processor 1501, the memory 1502, and the peripheral device interface 1503 are integrated on the same chip or circuit board; in some other embodiments, any one or two of the processor 1501, the memory 1502, and the peripheral device interface 1503 can be implemented on a separate chip or circuit board, and this embodiment does not limit this.

[0218] The radio frequency circuit 1504 is used to receive and transmit RF (Radio Frequency) signals, also known as electromagnetic signals. The radio frequency circuit 1504 communicates with a communication network and other communication devices through electromagnetic signals. The radio frequency circuit 1504 converts an electrical signal into an electromagnetic signal for transmission, or converts a received electromagnetic signal into an electrical signal. Optionally, the radio frequency circuit 1504 includes: an antenna system, an RF transceiver, one or more amplifiers, a tuner, an oscillator, a digital signal processor, a codec chip unit, a subscriber identity module card, and so on. The radio frequency circuit 1504 can communicate with other terminals through at least one wireless communication protocol. The wireless communication protocol includes but is not limited to: a metropolitan area network, each generation of mobile communication network (2G, 3G, 4G, and 5G), a wireless local area network, and / or a WiFi (Wireless Fidelity) network. In some embodiments, the radio frequency circuit 1504 may further include a circuit related to NFC (Near Field Communication), and this application does not limit this.

[0219] The display screen 1505 is used to display the UI (User Interface). The UI may include graphics, text, icons, videos, and any combination thereof. When the display screen 1505 is a touch display screen, the display screen 1505 also has the ability to collect touch signals on or above the surface of the display screen 1505. The touch signals can be input to the processor 1501 as control signals for processing. At this time, the display screen 1505 can also be used to provide virtual buttons and / or a virtual keyboard, also known as soft buttons and / or a soft keyboard. In some embodiments, there can be one display screen 1505, which is disposed on the front panel of the terminal; in other embodiments, there can be at least two display screens 1505, which are respectively disposed on different surfaces of the terminal or are in a foldable design; in other embodiments, the display screen 1505 can be a flexible display screen, which is disposed on a curved surface or a folding surface of the terminal. Even further, the display screen 1505 can also be set to an irregular non-rectangular shape, that is, a special-shaped screen. The display screen 1505 can be prepared using materials such as LCD (Liquid Crystal Display) and OLED (Organic Light-Emitting Diode).

[0220] The camera unit 1506 is used to collect images or videos. Optionally, the camera unit 1506 includes a front camera and a rear camera. Generally, the front camera is disposed on the front panel of the terminal, and the rear camera is disposed on the back of the terminal. In some embodiments, there are at least two rear cameras, which are respectively any one of a main camera, a depth-of-field camera, a wide-angle camera, and a telephoto camera, so as to implement the function of background blurring by fusing the main camera and the depth-of-field camera, panoramic shooting by fusing the main camera and the wide-angle camera, and VR (Virtual Reality) shooting function or other fusion shooting functions. In some embodiments, the camera unit 1506 can also include a flash. The flash can be a single-color-temperature flash or a dual-color-temperature flash. A dual-color-temperature flash refers to a combination of a warm-light flash and a cold-light flash, which can be used for light compensation under different color temperatures.

[0221] The audio circuit 1507 may include a microphone and a speaker. The microphone is used to collect sound waves of the user and the environment, and convert the sound waves into electrical signals for input to the processor 1501 for processing, or input to the radio frequency circuit 1504 to implement voice communication. For the purpose of stereo collection or noise reduction, there may be multiple microphones, which are respectively arranged at different parts of the terminal. The microphone may also be an array microphone or an omnidirectional collection microphone. The speaker is used to convert the electrical signals from the processor 1501 or the radio frequency circuit 1504 into sound waves. The speaker may be a traditional thin film speaker or a piezoelectric ceramic speaker. When the speaker is a piezoelectric ceramic speaker, it can not only convert electrical signals into sound waves audible to humans, but also convert electrical signals into sound waves inaudible to humans for uses such as ranging. In some embodiments, the audio circuit 1507 may further include a headphone jack.

[0222] The power supply 1509 is used to supply power to each component in the terminal. The power supply 1509 may be alternating current, direct current, a disposable battery or a rechargeable battery. When the power supply 1509 includes a rechargeable battery, the rechargeable battery may support wired charging or wireless charging. The rechargeable battery may also be used to support fast charging technology.

[0223] In some embodiments, the terminal further includes one or more sensors 1510. The one or more sensors 1510 include but are not limited to: an acceleration sensor 1511, a gyroscope sensor 1512, a pressure sensor 1513, an optical sensor 1515, and a proximity sensor 1516.

[0224] The acceleration sensor 1511 can detect the magnitudes of accelerations on the three coordinate axes of the coordinate system established with the terminal. For example, the acceleration sensor 1511 can be used to detect the components of the gravitational acceleration on the three coordinate axes. The processor 1501 can control the display screen 1505 to display the user interface in a landscape view or a portrait view according to the gravitational acceleration signal collected by the acceleration sensor 1511. The acceleration sensor 1511 can also be used for collecting game or user movement data.

[0225] The gyroscope sensor 1512 can detect the body direction and rotation angle of the terminal. The gyroscope sensor 1512 can cooperate with the acceleration sensor 1511 to collect the 3D actions of the user on the terminal. According to the data collected by the gyroscope sensor 1512, the processor 1501 can implement the following functions: motion sensing (such as changing the UI according to the user's tilting operation), image stabilization during shooting, game control, and inertial navigation.

[0226] The pressure sensor 1513 can be disposed on the side frame of the terminal and / or the lower layer of the display screen 1505. When the pressure sensor 1513 is disposed on the side frame of the terminal, it can detect the holding signal of the user on the terminal, and the processor 1501 performs left / right hand recognition or shortcut operation according to the holding signal collected by the pressure sensor 1513. When the pressure sensor 1513 is disposed on the lower layer of the display screen 1505, the processor 1501 controls the operable controls on the UI interface according to the pressure operation of the user on the display screen 1505. The operable controls include at least one of button controls, scroll bar controls, icon controls, and menu controls.

[0227] The optical sensor 1515 is used to collect the ambient light intensity. In one embodiment, the processor 1501 can control the display brightness of the display screen 1505 according to the ambient light intensity collected by the optical sensor 1515. Specifically, when the ambient light intensity is high, the display brightness of the display screen 1505 is increased; when the ambient light intensity is low, the display brightness of the display screen 1505 is decreased. In another embodiment, the processor 1501 can also dynamically adjust the shooting parameters of the camera unit 1506 according to the ambient light intensity collected by the optical sensor 1515.

[0228] The proximity sensor 1516, also known as the distance sensor, is usually disposed on the front panel of the terminal. The proximity sensor 1516 is used to collect the distance between the user and the front of the terminal. In one embodiment, when the proximity sensor 1516 detects that the distance between the user and the front of the terminal is gradually decreasing, the processor 1501 controls the display screen 1505 to switch from the lit state to the off state; when the proximity sensor 1516 detects that the distance between the user and the front of the terminal is gradually increasing, the processor 1501 controls the display screen 1505 to switch from the off state to the lit state.

[0229] Those skilled in the art can understand that Figure 15 the structure shown in

[0230] In an exemplary embodiment, a computer device is further provided. The computer device includes a processor and a memory, and at least one computer program is stored in the memory. The at least one computer program is loaded and executed by one or more processors to implement any one of the above virtual object movement control methods.

[0231] In an exemplary embodiment, a computer-readable storage medium is further provided. The computer-readable storage medium stores at least one computer program, and the at least one computer program is loaded and executed by the processor of the computer device to implement any one of the above virtual object movement control methods.

[0232] In one possible implementation, the above computer-readable storage medium may be a read-only memory (ROM), a random access memory (RAM), a compact disc read-only memory (CD-ROM), magnetic tape, floppy disk, optical data storage device, etc.

[0233] In an exemplary embodiment, a computer program product or a computer program is further provided. The computer program product or the computer program includes computer instructions, and the computer instructions are stored in a computer-readable storage medium. A processor of the computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes any one of the above virtual object movement control methods.

[0234] It should be noted that the terms "first", "second", etc. in the specification and claims of this application are used to distinguish similar objects, and do not necessarily have to be used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged under appropriate circumstances, so that the embodiments of the present application described here can be implemented in an order other than those illustrated or described here. The embodiments described in the above exemplary embodiments do not represent all embodiments consistent with the present application. On the contrary, they are merely examples of devices and methods consistent with some aspects of the present application as detailed in the appended claims.

[0235] It should be understood that the "plurality" mentioned herein refers to two or more. " / ", which describes the association relationship of associated objects, indicates that three relationships may exist. For example, A and / or B may represent: A exists alone, A and B exist simultaneously, and B exists alone. The character " / " generally represents an "or" relationship between the associated objects before and after.

[0236] The above are only exemplary embodiments of the present application, and are not intended to limit the present application. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principles of the present application shall be included in the protection scope of the present application.

Claims

1. A method for controlling the movement of a virtual object, characterized in that, The method is applied to a terminal, which stores terrain information of at least two virtual terrain units corresponding to a virtual environment. Different virtual terrain units correspond to different planar regions. The terrain information of any virtual terrain unit includes height values of virtual terrain grids that make up the any virtual terrain unit. The method includes: In response to a movement instruction of a target virtual object, determine target position information corresponding to the target virtual object and a radius of the target virtual object. The target position information includes a target planar coordinate and a target height value. Based on the target planar coordinate and the planar regions respectively corresponding to the at least two virtual terrain units, determine a target virtual terrain unit among the at least two virtual terrain units. Based on the target height value and the height values of the virtual terrain grids that make up the target virtual terrain unit, determine a target virtual terrain grid among the virtual terrain grids that make up the target virtual terrain unit. Based on the target virtual terrain grid, determine a target passable distance value corresponding to the target virtual object. In response to the target passable distance value being not greater than the radius of the target virtual object, based on the original movement direction of the target virtual object, determine a new movement direction of the target virtual object, and control the target virtual object to move in accordance with the new movement direction.

2. The method according to claim 1, characterized in that, The terrain information of any virtual terrain unit further includes passable distance values of the virtual terrain grids that make up the any virtual terrain unit. The determining the target passable distance value corresponding to the target virtual object based on the target virtual terrain grid includes: Determine first adjacent virtual terrain grids corresponding to the target virtual terrain grid. Based on the passable distance values of the first adjacent virtual terrain grids and the distance between the target planar coordinate and a reference boundary of the target planar region, determine the target passable distance value corresponding to the target virtual object. The target planar region is the planar region corresponding to the target virtual terrain unit.

3. The method according to claim 1, characterized in that, There is a target dynamic obstacle in the virtual environment. The determining the target passable distance value corresponding to the target virtual object based on the target virtual terrain grid includes: Based on the target virtual terrain grid, determine a first passable distance value corresponding to the target virtual object. Based on the target planar coordinate and a planar projection of the target dynamic obstacle, determine a second passable distance value corresponding to the target virtual object. Take the minimum value of the first passable distance value and the second passable distance value as the target passable distance value corresponding to the target virtual object.

4. The method according to claim 3, wherein The planar projection of the target dynamic obstacle is a target disk. The determining the second passable distance value corresponding to the target virtual object based on the target planar coordinate and the planar projection of the target dynamic obstacle includes: Calculate a first distance between the planar coordinate of the disk center of the target disk and the target planar coordinate. Take the difference between the first distance and the radius of the target disk as the second passable distance value corresponding to the target virtual object.

5. The method according to claim 3, characterized in that The planar projection of the target dynamic obstacle is a target rectangle; determining the second passable distance value corresponding to the target virtual object based on the target planar coordinates and the planar projection of the target dynamic obstacle includes: Determining the second passable distance value corresponding to the target virtual object based on the target planar coordinates, the planar coordinates of the rectangle center of the target rectangle, the steering angle corresponding to the target rectangle, and the boundary distance corresponding to the rectangle center of the target rectangle.

6. The method according to any one of claims 1-5, characterized in that, Determining the new movement direction of the target virtual object based on the original movement direction of the target virtual object includes: Determining the gradient direction corresponding to the target virtual object; Determining the new movement direction of the target virtual object based on the gradient direction and the original movement direction of the target virtual object.

7. According to the method described in any one of claims 1-5, characterized in that, The method further includes: Performing ray detection on the virtual terrain in the virtual environment to obtain height value information of at least two virtual terrain units corresponding to the virtual environment, where the height value information of any virtual terrain unit includes the height values of the virtual terrain grids constituting the any virtual terrain unit; For any one of the at least two virtual terrain units, obtaining passable distance value information of the any virtual terrain unit based on the height value information of the any virtual terrain unit, where the passable distance value information of the any virtual terrain unit includes the passable distance values of the virtual terrain grids constituting the any virtual terrain unit; Obtaining terrain information of at least two virtual terrain units corresponding to the virtual environment based on the height value information of the at least two virtual terrain units and the passable distance value information of the at least two virtual terrain units.

8. The method according to claim 7, wherein Obtaining the passable distance value information of the any virtual terrain unit based on the height value information of the any virtual terrain unit includes: For any virtual terrain grid constituting the any virtual terrain unit, determining a first height value interval corresponding to the any virtual terrain grid and a second height value interval corresponding to the any virtual terrain grid based on the height value of the any virtual terrain grid; Performing ray detection on the first height value interval and the second height value interval to determine the passable distance value of the any virtual terrain grid.

9. The method according to claim 8, wherein Performing ray detection on the first height value interval and the second height value interval to determine the passable distance value of the any virtual terrain grid includes: Emitting a first horizontal ray outward from the first height value interval, determining the ray length of the first horizontal ray, and taking the minimum value in the ray lengths of the first horizontal ray as the first distance value corresponding to the any virtual terrain grid; Emitting a second horizontal ray from the outside to the second height value interval, determining the horizontal distance between the termination position of the second horizontal ray and the grid center of the any virtual terrain grid, and taking the maximum value in the horizontal distances between the termination position of the second horizontal ray and the grid center of the any virtual terrain grid as the second distance value corresponding to the any virtual terrain grid. Take the minimum value of the first distance value and the second distance value as the passable distance value of any virtual terrain grid.

10. The method according to claim 8 or 9, characterized in that The determining the first height value interval corresponding to any virtual terrain grid and the second height value interval corresponding to any virtual terrain grid based on the height value of any virtual terrain grid includes: Take the sum of the height value of any virtual terrain grid and the first parameter as the first lower bound; take the sum of the height value of any virtual terrain grid and the second parameter as the first upper bound; take the height value interval formed by the first lower bound and the first upper bound and corresponding to any virtual terrain grid as the first height value interval corresponding to any virtual terrain grid; Take the difference between the height value of any virtual terrain grid and the third parameter as the second lower bound; take the height value of any virtual terrain grid as the second upper bound; take the height value interval formed by the second lower bound and the second upper bound and corresponding to any virtual terrain grid as the second height value interval corresponding to any virtual terrain grid; Wherein, the first parameter is used to indicate the maximum height of an obstacle that a virtual object can cross, the second parameter is used to indicate the height of a virtual object, and the third parameter is used to indicate the maximum height of a virtual cliff that a virtual object can cross.

11. According to the method described in any one of claims 1-5, characterized in that, After determining the target passable distance value corresponding to the target virtual object, the method further includes: In response to the target passable distance value being greater than the radius of the target virtual object, control the target virtual object to move in the original moving direction.

12. A moving control device for a virtual object, characterized in that, The device includes: A first determination unit, configured to, in response to a movement instruction of a target virtual object, determine target position information corresponding to the target virtual object and the radius of the target virtual object, where the target position information includes a target plane coordinate and a target height value; the virtual environment where the target virtual object is located corresponds to terrain information of at least two virtual terrain units, different virtual terrain units correspond to different plane regions, and the terrain information of any virtual terrain unit includes the height values of the virtual terrain grids that make up any virtual terrain unit; A second determination unit, configured to determine a target virtual terrain unit among the at least two virtual terrain units based on the target plane coordinate and the plane regions respectively corresponding to the at least two virtual terrain units; determine a target virtual terrain grid among the virtual terrain grids that make up the target virtual terrain unit based on the target height value and the height values of the virtual terrain grids that make up the target virtual terrain unit; determine the target passable distance value corresponding to the target virtual object based on the target virtual terrain grid; A third determination unit, configured to, in response to the target passable distance value not being greater than the radius of the target virtual object, determine a new moving direction of the target virtual object based on the original moving direction of the target virtual object; A control unit, configured to control the target virtual object to move in the new moving direction.

13. The device according to claim 12, characterized in that, The terrain information of any one of the virtual terrain units further includes the passable distance values of the virtual terrain grids that make up any one of the virtual terrain units; the second determination unit is configured to determine the first adjacent virtual terrain grids corresponding to the target virtual terrain grid; and based on the passable distance values of the first adjacent virtual terrain grids and the distance between the target plane coordinates and the reference boundary of the target plane area, determine the target passable distance value corresponding to the target virtual object, where the target plane area is the plane area corresponding to the target virtual terrain unit.

14. The device according to claim 12, characterized in that, There is a target dynamic obstacle in the virtual environment, and the second determination unit is configured to determine the first passable distance value corresponding to the target virtual object based on the target virtual terrain grid; Based on the target plane coordinates and the planar projection of the target dynamic obstacle, determine the second passable distance value corresponding to the target virtual object; and use the minimum value of the first passable distance value and the second passable distance value as the target passable distance value corresponding to the target virtual object.

15. The device according to claim 14, characterized in that, The planar projection of the target dynamic obstacle is a target disk; the second determination unit is configured to calculate the first distance between the planar coordinates of the center of the target disk and the target plane coordinates; and use the difference between the first distance and the radius of the target disk as the second passable distance value corresponding to the target virtual object.

16. The device according to claim 14, characterized in that, The planar projection of the target dynamic obstacle is a target rectangle; the second determination unit is configured to determine the second passable distance value corresponding to the target virtual object based on the target plane coordinates, the planar coordinates of the center of the target rectangle, the steering angle corresponding to the target rectangle, and the boundary distance corresponding to the center of the target rectangle.

17. The device according to any one of claims 12-16, characterized in that, The third determination unit is configured to determine the gradient direction corresponding to the target virtual object; and based on the gradient direction and the original movement direction of the target virtual object, determine the new movement direction of the target virtual object.

18. The device according to any one of claims 12 - 16, characterized in that, The device further includes: A detection unit configured to perform ray detection on the virtual terrain in the virtual environment to obtain the height value information of at least two virtual terrain units corresponding to the virtual environment. The height value information of any one of the virtual terrain units includes the height values of the virtual terrain grids that make up any one of the virtual terrain units; An acquisition unit configured to, for any one of the at least two virtual terrain units, based on the height value information of any one of the virtual terrain units, acquire the passable distance value information of any one of the virtual terrain units. The passable distance value information of any one of the virtual terrain units includes the passable distance values of the virtual terrain grids that make up any one of the virtual terrain units; The acquisition unit is further configured to obtain the terrain information of at least two virtual terrain units corresponding to the virtual environment based on the height value information of the at least two virtual terrain units and the passable distance value information of the at least two virtual terrain units.

19. The device according to claim 18, characterized in that, The obtaining unit is configured to, for any virtual terrain grid constituting any virtual terrain unit, determine a first height value interval corresponding to the any virtual terrain grid and a second height value interval corresponding to the any virtual terrain grid based on the height value of the any virtual terrain grid; perform ray detection on the first height value interval and the second height value interval to determine the passable distance value of the any virtual terrain grid.

20. The device according to claim 19, characterized in that, The obtaining unit is configured to emit a first horizontal ray outward from the first height value interval, determine the ray length of the first horizontal ray, and use the minimum value in the ray lengths of the first horizontal ray as the first distance value corresponding to the any virtual terrain grid; emit a second horizontal ray from the outside to the second height value interval, determine the horizontal distance between the termination position of the second horizontal ray and the grid center of the any virtual terrain grid, and use the maximum value in the horizontal distances between the termination position of the second horizontal ray and the grid center of the any virtual terrain grid as the second distance value corresponding to the any virtual terrain grid; use the minimum value in the first distance value and the second distance value as the passable distance value of the any virtual terrain grid.

21. The device according to claim 19 or 20, characterized in that The obtaining unit is configured to use the sum of the height value of the any virtual terrain grid and a first parameter as a first lower bound; use the sum of the height value of the any virtual terrain grid and a second parameter as a first upper bound; use the height value interval formed by the first lower bound and the first upper bound and corresponding to the any virtual terrain grid as the first height value interval corresponding to the any virtual terrain grid; use the difference between the height value of the any virtual terrain grid and a third parameter as a second lower bound; use the height value of the any virtual terrain grid as a second upper bound; use the height value interval formed by the second lower bound and the second upper bound and corresponding to the any virtual terrain grid as the second height value interval corresponding to the any virtual terrain grid; wherein, the first parameter is used to indicate the maximum height of an obstacle that a virtual object can cross, the second parameter is used to indicate the height of the virtual object, and the third parameter is used to indicate the maximum height of a virtual cliff that a virtual object can cross.

22. The device according to any one of claims 12-16, characterized in that The control unit is further configured to, in response to the target passable distance value being greater than the radius of the target virtual object, control the target virtual object to move in the original moving direction.

23. A computer device, characterized in that, The computer device includes a processor and a memory, and at least one computer program is stored in the memory, and the at least one computer program is loaded and executed by the processor to implement the method for controlling the movement of a virtual object according to any one of claims 1 to 11.

24. A computer-readable storage medium, characterized in that, At least one computer program is stored in the computer-readable storage medium, and the at least one computer program is loaded and executed by a processor to implement the method for controlling the movement of a virtual object according to any one of claims 1 to 11.

25. A computer program product, characterized in that, The computer program product includes computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions to cause the computer device to execute the method for controlling the movement of a virtual object according to any one of claims 1 to 11.

Citation Information

Patent Citations

  • AI dynamic automatic way-finding method

    CN107433039A

  • Collision detection method and device, storage medium and electronic device

    CN110180182A