Target object control method and system and computer program product
The method addresses collision issues in virtual games by detecting obstacles and guiding target objects along obstacle avoidance trajectories, enhancing player control and gaming experience through smooth navigation.
Patent Information
- Application Number
- CN202411194904.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-28
- Publication Date
- 2024-12-17
AI Technical Summary
In virtual games, unexpected collisions due to obstacles like enemy attacks or reduced visibility can negatively impact player control and experience, particularly when moving target objects at high speeds or in complex environments.
A method for controlling target objects in virtual scenes involves detecting obstacles based on an initial travel direction and distance, determining an obstacle avoidance end position and trajectory, and guiding the object along a monotonic curve to avoid collisions, using modules for position determination, trajectory calculation, and travel control.
Enhances player control by automatically avoiding obstacles, ensuring smooth movement and improving gaming experience by preventing collisions, especially in challenging conditions.
Smart Images

Figure CN119139705A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of virtual game technology, and more particularly to a target object control method, system and computer program product. Background Art
[0002] In a virtual game, when a player is manipulating a target object to move, an unexpected collision may occur due to factors such as enemy attacks and smoke, which may have a negative impact on the player's game operation or experience. To this end, some embodiments of this specification are intended to provide a method for controlling a target object in a virtual scene, in order to assist the player in manipulating the target object when necessary. Summary of the invention
[0003] One or more embodiments of the present specification provide a target object control method, including: in response to a detection result of an obstacle detected in a virtual scene based on an initial travel direction of the target object and a preset detection distance, obtaining initial position information of the target object; determining obstacle avoidance end position information based on the obstacle; wherein the obstacle avoidance end position enables the target object to move away from the obstacle when traveling at the obstacle avoidance end position according to the initial travel direction; determining an obstacle avoidance driving trajectory based on the initial position information and the obstacle avoidance end position information; and controlling the target object to travel based on the obstacle avoidance driving trajectory so that the target object reaches the obstacle avoidance end position.
[0004] According to the method described in some embodiments of the present specification, determining the obstacle avoidance end position information based on the obstacle includes: determining a first straight line passing through the center point of the obstacle and perpendicular to the initial driving direction; determining a first point on the first straight line; wherein the distance from the first point to the center point is not less than a preset anti-collision threshold; and determining the obstacle avoidance end position information based on the first point.
[0005] According to the method described in some embodiments of the present specification, determining the obstacle avoidance driving trajectory based on the initial position information and the obstacle avoidance end position information includes: determining the obstacle avoidance driving trajectory based on a curve segment connecting the initial position corresponding to the initial position information and the obstacle avoidance end position.
[0006] According to the methods described in some embodiments of this specification, the curve segment is a monotonic curve segment.
[0007] According to the method described in some embodiments of this specification, the curve segment is a monotonic cosine curve segment or a monotonic sine curve segment within half a period.
[0008] According to the method described in some embodiments of the present specification, the control of the target object to move based on the obstacle avoidance driving trajectory so that the target object reaches the obstacle avoidance end position includes: determining the second travel position component of the target object based on the obstacle avoidance driving trajectory and the first travel position component of the target object; wherein the first travel position component reflects the travel position information of the target object in the initial travel direction, and the second position component reflects the travel position information of the target object in a direction perpendicular to the initial travel direction; and controlling the target object to move based on the first travel position component and the second travel position component so that the target object reaches the obstacle avoidance end position.
[0009] According to the method described in some embodiments of the present specification, the second travel position component of the target object is determined based on the obstacle avoidance driving trajectory and the first travel position component of the target object, including: determining a curve equation corresponding to the obstacle avoidance driving trajectory, the curve equation having a first variable and a second variable; using the first travel position component as the variable value of the first variable, solving the curve equation to obtain the variable value of the second variable; and determining the second travel position component based on the variable value of the second variable.
[0010] The method described in some embodiments of the present specification further includes performing obstacle detection in the virtual scene based on an initial travel direction of the target object and a preset detection distance.
[0011] According to the method described in some embodiments of the present specification, obstacle detection is performed in a virtual scene based on an initial travel direction of a target object and a preset detection distance, including: determining a ray beam based on a current position of the target object and along the initial travel direction; wherein a width of the ray beam is related to a width of the target object; when a distance between an overlapping area of the ray beam and a collision determination box of a candidate obstacle object in the virtual scene and the current position of the target object is less than the preset detection distance, determining the obstacle based on the candidate obstacle object; wherein the collision determination box of the candidate obstacle object is determined based on a boundary of the candidate obstacle object.
[0012] According to the method described in some embodiments of the present specification, the determining of the obstacle based on the candidate obstacle object further includes: obtaining collision judgment box height information of the candidate obstacle object; obtaining chassis height information of the target object; when the collision judgment box height information is greater than the chassis height information, determining the candidate obstacle object as the obstacle; or further includes: obtaining collision judgment box height information of the candidate obstacle object; obtaining flight height information of the target object; when the collision judgment box height information is greater than the flight height information, determining the candidate obstacle object as the obstacle.
[0013] One or more embodiments of the present specification also provide another target object control method, comprising: in response to a preset condition being met, executing any of the aforementioned methods; wherein the preset condition includes one or more of the following conditions: the time when the travel control corresponding to the target object is triggered exceeds a preset duration, the frequency when the travel control corresponding to the target object is triggered exceeds a preset frequency, and the target object or the virtual character it carries is in a combat state.
[0014] One or more embodiments of the present specification also provide a target object control system, characterized in that it includes: an initial position determination module, which is used to obtain the initial position information of the target object in response to the detection result of an obstacle detected in a virtual scene based on the initial travel direction of the target object and a preset detection distance; an obstacle avoidance end position determination module, which is used to determine the obstacle avoidance end position information based on the obstacle; wherein the obstacle avoidance end position enables the target object to move away from the obstacle when traveling at the obstacle avoidance end position according to the initial travel direction; an obstacle avoidance trajectory determination module, which is used to determine an obstacle avoidance driving trajectory based on the initial position information and the obstacle avoidance end position information; and a target object travel control module, which is used to control the target object to travel based on the obstacle avoidance driving trajectory so that the target object reaches the obstacle avoidance end position.
[0015] According to some embodiments of the present specification, the system further includes an obstacle detection module for performing obstacle detection in a virtual scene based on an initial moving direction of a target object and a preset detection distance.
[0016] One or more embodiments of the present specification further provide a computer program product, including computer codes, which can implement any of the aforementioned methods when at least part of the computer codes is executed by a processor. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] This specification will be further explained by way of exemplary embodiments, which will be described in detail by way of the accompanying drawings. The same numbers in the drawings represent the same structures or steps.
[0018] Figure 1 It is a schematic diagram of a virtual game system according to some embodiments of this specification.
[0019] Figure 2 It is a schematic diagram of a target object colliding while moving according to some embodiments of this specification.
[0020] Figure 3 It is an exemplary flow chart of the target object control method shown in some embodiments of this specification.
[0021] Figure 4 It is a schematic diagram of effect 1 of controlling the movement of a target object using the target object control method shown in some embodiments of this specification.
[0022] Figure 5 It is a schematic diagram of effect 2 of controlling the movement of a target object using the target object control method shown in some embodiments of this specification.
[0023] Figure 6 It is a schematic diagram of effect 3 of controlling the movement of a target object using the target object control method shown in some embodiments of this specification.
[0024] Figure 7 is an exemplary block diagram of a target object control system according to some embodiments of the present specification. DETAILED DESCRIPTION
[0025] In order to more clearly illustrate the technical solutions of the embodiments of this specification, the embodiments will be described in detail below with reference to the accompanying drawings. Obviously, the contents described below are some examples or embodiments of this specification. For ordinary technicians in this field, without paying creative work, the technical solutions or means disclosed in this specification can also be applied to other scenarios based on these technical contents.
[0026] It should be understood that the "system", "device", "unit" and / or "module" used in this specification is a method for distinguishing different components, elements, parts, portions or assemblies at different levels. However, if other words can achieve the same purpose, the words can be replaced by other expressions.
[0027] Unless otherwise specified, technical terms used in this specification to describe components, elements, etc. do not refer to the singular, but may also include the plural. Generally speaking, terms such as "include", "comprise", etc. only indicate that the steps, elements, or components that have been clearly identified are included, and these steps, elements, and components do not constitute an exclusive list, such as the method or device described may also include other steps or components.
[0028] Flowcharts are used in this specification to illustrate the operation steps performed by the device or system of the relevant embodiments, but unless otherwise specified, the order used to describe these steps should not be understood as a limitation on the order in which the steps are performed. A person of ordinary skill in the art can adjust the order in which these steps are performed based on the knowledge and information conveyed by the embodiments of this specification, and the adjustment includes but is not limited to swapping the order, merging multiple steps, and splitting a certain step.
[0029] Virtual games, also known as video games or electronic games, are games that run on electronic devices and are controlled by computer programs (such as game applications) for educational or entertainment purposes. The game scenes of virtual games can be presented through a graphical user interface (GUI). Game scenes (also referred to as virtual scenes) include elements such as the environment, characters, buildings, machinery, and props in virtual games (these elements can also be called objects), which can restore at least part of the virtual world in the game. Users (or players) input game operations or game control instructions through human-computer interface devices (such as game controllers, keyboards, mice, touch screens, cameras, etc.), and computer programs respond to game operations and present them to users through graphical user interfaces.
[0030] Figure 1 Schematic diagram of a virtual game system according to some embodiments of this specification. Figure 1 As shown, the virtual game system 100 may include a server 110, a network 120, a storage medium 130, and a user terminal 140. The server 110 and the user terminal 140 may perform data transmission via the network 120.
[0031] The server 110 (or game server) may be a computer device with high computing performance, used to maintain and manage game data and game player data, synchronize and broadcast the interactive data of game players in the game, or complete some relatively complex calculations or logic processing in the virtual game. In some embodiments, the server 110 may also publish various versions of game applications for game players to download or update. In some embodiments, the server 110 may be a single computer device or a computing cluster composed of multiple computer devices, so as to provide more powerful computing power and more efficient response to service requests of game players.
[0032] The network 120 may be any form of wired or wireless network, or any combination thereof. As just an example, the network 120 may be one or more combinations of a wired network, an optical fiber network, a telecommunications network, an intranet, the Internet, a local area network (LAN), a wide area network (WAN), a wireless local area network (WLAN), a metropolitan area network (MAN), a wide area network (WAN), a public switched telephone network (PSTN), a Bluetooth network, etc. The network 120 may have multiple access points, and the server 110 and the user terminal 140 may access the network 120 through the access points.
[0033] The storage medium 130 may be used for data and / or instructions related to the virtual game system 100. In some embodiments, the storage medium 130 may store data and / or information obtained from the server 110, the user terminal 140, etc. As an example, the storage medium 130 may store game player data, etc. In some embodiments, the storage medium 130 may include one or more storage components, each of which may be an independent device or part of another device. In some embodiments, the storage medium 130 may be set in the server 110. In some embodiments, the storage medium 130 may include a random access memory (RAM), a read-only memory (ROM), a large capacity memory, a removable memory, a volatile read-write memory, etc. or any combination thereof. Exemplarily, the large capacity storage may include a magnetic disk, an optical disk, a solid-state disk, etc. In some embodiments, the storage medium 130 may be implemented on a cloud platform.
[0034] The user terminal 140 may include, but is not limited to, a desktop computer, a smart phone, a laptop computer, a VR (Virtual Reality) device, a touch screen, a personal computer (PC), a personal digital assistant (PDA), a game console, a tablet computer and other terminal devices. The user terminal 140 may also include a client application, which may be a game application, a browser carrying a game program, or an instant messaging application. For example, a game player may install and run a game application on the user terminal 140, display the game screen through the terminal device, and participate in the game through a human-computer interface device. As an example, the user terminal 140 may have a signal connection with the server 110 through the network 120, and the game player may download the game from the server 110 for installation. The human-computer interface device may be a part of the user terminal 140, or may be separated from the user terminal 140, but may have a signal connection with each other. In some embodiments, the virtual game may be a networked game, and the user terminals 140 of multiple game players may be connected to the server 110 through the network 120. With the participation of the server 110, multiple game players may interactively participate in the game.
[0035] It should be understood that Figure 1 The virtual game system 100 shown is only an example, and its architecture should not be understood as a limitation on the virtual game system. Figure 1 The server 110, network 120, and storage medium 130 shown may be omitted.
[0036] In a virtual game, players can manipulate the target object to move. The target object can be a vehicle that carries the virtual character controlled by the player, such as a car, motorcycle, skateboard, mount, or other props in a virtual scene, or it can be the virtual character itself controlled by the player. Taking the vehicle in the virtual scene as an example, the player can manipulate the virtual character to ride the vehicle and control the vehicle to quickly deliver the virtual character to the mission location in the virtual scene. However, there are often static objects such as rocks, boxes, buildings, and trees in the virtual scene, which may become obstacles in the process of the target object moving. Figure 2 is a schematic diagram of a target object colliding while traveling according to some embodiments of this specification. Figure 2As an example, the player controls the vehicle to move forward, and there are rocks in the direction of the vehicle. At this time, the player needs to change the direction of the vehicle, otherwise the vehicle will collide with the rocks. However, in some embodiments, the speed of the vehicle may be very fast (such as to avoid enemy attacks or pursuit), which makes it difficult for the player to control the vehicle in time to avoid obstacles and cause accidental collisions, or the visibility in the area where obstacles such as rocks are located is low (such as encountering enemy smoke bomb attacks or foggy weather), and the player cannot understand the terrain conditions in time, resulting in the vehicle being unable to avoid obstacles in time and causing accidental collisions. The occurrence of a collision may affect the state of the target object or virtual character (such as health, combat power, etc.), or the collision may delay the progress of the vehicle to a large extent. Therefore, frequent and difficult-to-control accidental collisions are likely to have a negative impact on the player's game operation or game experience.
[0037] To this end, some embodiments of this specification provide a method for controlling a target object in a virtual scene, in order to assist a player in controlling the target object when necessary.
[0038] A target object control method provided in an embodiment of the present specification may be executed by a computer device, wherein the computer device may be a terminal (such as Figure 1 The user terminal 140 shown) or the server (such as Figure 1 For example, when the target object control method is run on a terminal, the terminal device stores a game application and is used to present a virtual scene in the game screen. For example, the terminal device may include a touch screen and a processor, the touch screen is used to present a graphical user interface and receive an operation instruction generated by a user acting on the graphical user interface, and the processor is used to run the game, generate a graphical user interface, respond to the operation instruction, and control the display of the graphical user interface on the touch screen. The terminal device may provide the graphical user interface to the user in a variety of ways, for example, it may be rendered and displayed on the display screen of the terminal device, or the graphical user interface may be presented through holographic projection. For example, when the target object control method is run on a server, it may be a cloud game. Cloud gaming refers to a gaming method based on cloud computing. In the operation mode of cloud gaming, the operating body of the game application and the game screen presentation body are separated, and the storage and operation of the target object control method are completed on the cloud gaming server. The game screen presentation is completed on the client of the cloud gaming, and the cloud gaming client is mainly used for receiving and sending game data and presenting the game screen. For example, the cloud gaming client may be located on a terminal device close to the user side. When playing the game, the user operates the cloud game client to send operation instructions to the cloud game server. The cloud game server runs the game according to the operation instructions, encodes and compresses the game screen and other data, and returns it to the cloud game client through the network. Finally, the cloud game client decodes and outputs the game screen.
[0039] Figure 3 is an exemplary flow chart of a target object control method according to some embodiments of this specification. As mentioned above, Figure 3 The process 300 shown may be executed on a computer device, such as a user terminal 140 or a server 110. Specifically, the process 300 may be implemented by a target object control system 700 deployed on the computer device. In some embodiments, the process 300 may include the following steps.
[0040] Step 310 , in response to the detection result of obstacles detected in the virtual scene based on the initial moving direction of the target object and the preset detection distance, obtain the initial position information of the target object. In some embodiments, step 310 can be implemented by the initial position determination module 710 .
[0041] The target object may be an object controlled by the game player. Specifically, the game player may control the object through a user terminal or a human-machine interface having a signal connection therewith. The target object may be a vehicle, a mount or other vehicle carrying a virtual character corresponding to the game player, or may be the aforementioned virtual character itself. For the convenience of illustration, some embodiments of this specification mainly use vehicle travel as an example, but this should not be understood as a limitation on the target object shown in the embodiments of this specification.
[0042] The initial direction of travel of the target object may be the direction of travel of the target object before an obstacle is detected. In some embodiments, the initial direction of travel may be the direction in which the player controls the target object to travel. For example, the player may control the target object to continuously move or travel in a specified direction of travel at a certain speed by continuously triggering the travel control corresponding to the target object. When the target object is traveling, it may be determined in real time whether an obstacle appears in the initial direction of travel of the target object and within a preset detection distance according to a preset obstacle detection method. When an obstacle is detected, the current position information of the target object may be obtained as the initial position information.
[0043] In some embodiments, the position information may be represented by a coordinate value in a preset coordinate system, specifically a two-dimensional coordinate value or a three-dimensional coordinate value. As an example, the position information may be a three-dimensional coordinate value in a game world coordinate system, or the position information may be two components of the three-dimensional coordinate value in the game world coordinate system except for the height component, or the position information may be a coordinate value in a top-down projection plane coordinate system of the target object, etc.
[0044] In some embodiments, the preset detection distance can be flexibly set according to actual needs, such as being determined according to the length unit in the virtual scene, specifically 5m, 10m, etc., or being determined according to the length unit of the graphical user interface displaying the virtual scene, specifically 3cm, 5cm, 8cm, etc., or being determined according to the resolution of the display device, specifically 100 pixels, 500 pixels, and so on.
[0045] In some embodiments, the detection result of the obstacle detected may be processed or calculated by an obstacle detection method other than process 300, and the initial position determination module 310 may directly receive the detection result obtained by the aforementioned algorithm. In other embodiments, process 300 may also include an obstacle detection method. More information about the obstacle detection method can be found later and will not be repeated here.
[0046] Figure 4 It is a schematic diagram of effect 1 of controlling the movement of a target object using the target object control method shown in some embodiments of this specification. Figure 4 The rock on the left is the detected obstacle, and position A is the initial position of the target object (such as a vehicle). The initial position is the position of the target object when the obstacle is detected. Figure 4 When the target object is at position A, its center point is taken as the origin, the initial moving direction of the target object is taken as the x-axis direction (the positive direction is consistent with the moving direction), and the horizontal direction perpendicular to the initial moving direction is taken as the y-axis direction (the horizontal left direction can be set as the positive direction) to establish a top-view projection plane coordinate system, and the coordinate value (0,0) of the center point of the target object at position A is taken as the initial position information. Further, the distance from the center point of the target object to the center point of the obstacle at this time can be recorded as d. In some embodiments, the distance d can be equal to the preset detection distance, or it can be less than the preset detection distance.
[0047] In some embodiments, the center point of the target object may be the symmetrical center point, the center of gravity, or the center of mass of the target object. In some embodiments, a collision judgment box of the target object may be determined. The collision judgment box may also be called a collision prototype. The collision judgment box may be determined based on the boundary of the object in the virtual scene. For example, it may be a geometric area in the virtual scene that is slightly larger than the boundary of the object and can surround the object. As an example, the area may be a three-dimensional shape such as a cuboid, a sphere, or a capsule. When other objects enter the area, some specific events or behaviors may be triggered, such as a collision. In some embodiments, the symmetrical center point of the collision judgment box of the target object may be determined as the center point of the target object.
[0048] Step 320 , determining obstacle avoidance end position information based on the obstacle. In some embodiments, step 320 may be implemented by obstacle avoidance end position determination module 720 .
[0049] In some embodiments, the obstacle avoidance end position allows the target object to move away from the obstacle when traveling in the initial direction of travel at the obstacle avoidance end position. That is, when the target object reaches the obstacle avoidance end position, it is no longer controlled by process 300 and returns to the direction of travel before the obstacle is detected.
[0050] In some embodiments, a first straight line passing through the center point of the obstacle and perpendicular to the initial driving direction of the target object can be determined; a first point can be determined on the first straight line; wherein the distance from the first point to the center point of the obstacle is not less than a preset anti-collision threshold; and obstacle avoidance end position information can be determined based on the first point. For example, the coordinate value of the first point can be determined as the obstacle avoidance end position information. In some embodiments, the center point of the obstacle can be the symmetrical center point, the center of gravity, or the center of mass of the obstacle. In some embodiments, the collision judgment box of the obstacle can be determined, and the symmetrical center point of the collision judgment box of the obstacle can be determined as the center point of the target object. In some embodiments, the preset anti-collision threshold h can be flexibly set according to actual conditions so that the target object will not contact the obstacle when it is in the obstacle avoidance end position. In some embodiments, the collision judgment box of the obstacle can be further determined, and its center point can be determined as the obstacle center point. When the target object is in the obstacle avoidance end position and its center point coincides with the first point, the preset anti-collision threshold h can make the collision judgment box of the target object and the collision judgment box of the obstacle not overlap, and further, the collision judgment box of the target object and the collision judgment box of the obstacle can be separated by a certain space interval to improve the reliability of anti-collision.
[0051] by Figure 4 As an example, a first straight line passing through the center point of the obstacle and perpendicular to the initial travel direction of the target object can be determined in the top-view projection plane. Based on the aforementioned preset anti-collision threshold h, a first point is taken on the left side of the obstacle on the first straight line. Based on the first point, the obstacle avoidance end position B can be determined. Further, the first point can be Figure 4 The coordinate value (d, h) in the established coordinate system is used as the obstacle avoidance end position information.
[0052] In some alternative embodiments, other positions may also be determined as obstacle avoidance end positions. Figure 4 In the method, a second straight line passing through the first point and parallel to the initial traveling direction is determined, and a point on the second straight line above the first point is determined as the obstacle avoidance end position.
[0053] Step 330 , based on the initial position information and the obstacle avoidance end position information, determine the obstacle avoidance driving trajectory. In some embodiments, step 330 may be implemented by the obstacle avoidance trajectory determination module 730 .
[0054] The obstacle avoidance driving trajectory can be a driving path that controls the target object from the initial position to the obstacle avoidance end position. When the target object drives along this trajectory, it will not collide with obstacles. In some embodiments, in order to make the target object's driving process smoother, the obstacle avoidance driving trajectory can be determined based on a curve segment connecting the initial position and the obstacle avoidance end position. Specifically, the curve segment can be taken from a sine curve or a cosine curve. It should be understood that the sine curve and the cosine curve are similar in shape, mainly in phase difference. For the convenience of example, the cosine curve will be mainly used for explanation below.
[0055] like Figure 4 As shown, the dotted line between the initial position A and the obstacle avoidance end position B can be a monotonic curve segment, which can effectively avoid the target object's direction of travel being significantly adjusted, ensure the target object's smooth travel, and improve the player's gaming experience. When the obstacle avoidance driving trajectory is set based on a monotonic curve segment, the target object can gradually move away from the obstacle in a direction perpendicular to the initial direction of travel from the initial position, thereby avoiding a collision during driving. In some embodiments, the aforementioned monotonic curve segment can be a monotonic curve segment within a half-period in a cosine curve or a sine curve.
[0056] In some embodiments, a curve equation may be used to characterize an obstacle avoidance driving trajectory or a curve segment. Figure 4 Taking the established top-view projection plane coordinate system as an example, the obstacle avoidance trajectory can be characterized by the following curve equation: y-y0=(1-cos (x-x0) π / d)h / 2, where (x0, y0) is the initial position information, the physical meanings of d and h are as described above, x is the first variable, and its value range is x0~x0+d, and y is the second variable. When the initial position information is (0,0), the above curve equation can be further simplified to y=(1-cos (xπ / d)h / 2.
[0057] Step 340 , controlling the target object to move based on the obstacle avoidance driving trajectory, so that the target object reaches the obstacle avoidance end position. In some embodiments, step 340 may be implemented by the target object moving control module 740 .
[0058] In some embodiments, the target object travel control module 740 can determine the positions that the target object should reach in sequence after leaving the initial position based on the obstacle avoidance driving trajectory, and then guide the target object to reach the obstacle avoidance end position.
[0059] In some embodiments, the second travel position component of the target object may be determined based on the obstacle avoidance driving trajectory and the first travel position component of the target object, wherein the first travel position component may reflect the travel position information of the target object in the initial travel direction, and the second travel position component may reflect the travel position information of the target object in a direction perpendicular to the initial travel direction.
[0060] In some embodiments, the first travel position component may specifically be the position coordinate value of the target object in the initial travel direction at a certain speed. Specifically, the first travel position component may be determined based on the travel speed v of the target object in the initial travel direction before the obstacle is detected and the travel time t. In some embodiments, the travel time t may be the time interval from the detection of the obstacle to the current moment when the first travel position component is determined. Figure 4 As an example, based on Figure 4 The top-down projection plane coordinate system may use vt (i.e., 0+vt) as the first travel position component. In other embodiments, when the initial position information of the target object is not at the origin, the first travel position component may be x0+vt or x0-vt, where the positive and negative signs depend on the positive direction orientation of the corresponding coordinate axis.
[0061] Continue to refer Figure 4 , the second position component can be specifically represented by the travel position coordinate value in the y direction. In some embodiments, the target object can be controlled to move based on the first travel position component and the second travel position component so that the target object reaches the obstacle avoidance end position. As an example, the first travel position component changes with time. Therefore, the second travel position component corresponding to each first travel position component can be obtained in real time based on the first travel position component corresponding to each time point and the obstacle avoidance driving trajectory. The first travel position component and the corresponding second travel position component are further used as the coordinate values of the position point of the target object after leaving the initial position, so that the target object can be controlled to move along the obstacle avoidance driving trajectory.
[0062] In some embodiments, the curve equation of the obstacle avoidance driving trajectory can be determined, such as y-y0=(1-cos (x-x0) π / d)h / 2, where x is the first variable and y is the second variable. The first travel position component can be substituted into the aforementioned curve equation as the variable value of x, the variable value of y can be calculated, and the second position component can be determined based on the variable value of the second variable. Specifically, the variable value of the second variable can be used as the second travel position component.
[0063] The first travel position component changes with time, so the aforementioned curve equation can be used in real time to calculate the second travel position component corresponding to each first travel position component. Furthermore, the first travel position component and its corresponding second travel position component can be used as the first component and the second component (such as the x-coordinate value and the y-coordinate value) of the position coordinate value of the target object during the travel process, respectively, so as to control the target object to move along the obstacle avoidance driving trajectory as time goes by and reach the obstacle avoidance end position.
[0064] In some embodiments, when the target object reaches the obstacle avoidance end position, the control of process 300 can be terminated, and the movement of the target object can continue to be controlled based on the player's control instructions (such as the direction of travel, the speed of travel, etc.). Figure 4 As shown, when the vehicle reaches position B, it can travel in the initial travel direction and stay away from obstacles. The target object control method provided in some embodiments of this specification can take over the travel control of the target object when an obstacle is detected, such as controlling the travel of the target object according to the first travel position component and the second travel position component calculated according to process 300, thereby achieving obstacle avoidance. When the target object reaches the obstacle avoidance end position, its travel control can be restored to the player's control. At this time, even if the target object travels in the initial travel direction, it will not collide with the detected obstacle.
[0065] In some optional embodiments, the process 300 may further include performing obstacle detection in the virtual scene based on the initial traveling direction of the target object and a preset detection distance. In some embodiments, this step may be implemented by the obstacle detection model 750 .
[0066] In a virtual scene, there are often static objects such as rocks, buildings, and boxes. When these objects are located in the direction of travel of the target object, the target object will collide with them as time goes on, so obstacle detection can be performed based on the initial direction of travel of the target object. In some embodiments, objects other than the target object in the virtual scene can be referred to as obstacle candidates for obstacle detection. In some embodiments, a ray beam can be determined based on the current position of the target object (such as the position of the target object when obstacle detection is performed) and along its direction of travel (such as the initial direction of travel), wherein the width of the ray beam can be related to the width of the target object. In some embodiments, the width of the ray beam can be the size of the ray beam in a direction perpendicular to the direction in which the ray beam is emitted, and the width of the target object can be the size of the target object in a direction perpendicular to the initial direction of travel, such as Figure 4The width of the vehicle shown. The width of the beam can be determined based on the width of the target object. As an example, the width of the beam can be equal to or greater than the width of the target object. In some embodiments, the collision judgment box of the candidate obstacle object can be determined, and it can be determined whether the beam has an overlapping area with the collision judgment box of the candidate obstacle object. The overlapping area can be the area where the beam intersects with the collision judgment box of the candidate obstacle object. When the beam has an overlapping area with the collision judgment box of the candidate obstacle object, it means that when the target object continues to travel in the current direction of travel, it will inevitably collide with the candidate obstacle object and need to avoid obstacles. In some embodiments, when the distance between the overlapping area of the beam and the collision judgment box of the candidate obstacle object in the virtual scene and the current position of the target object is less than a preset detection distance, an obstacle can be determined based on the candidate obstacle object. In some embodiments, the distance between the boundary point of the overlapping area or a point inside it and a point on the target object (such as the center point of the target object) can be determined. When the aforementioned distance is less than the preset detection distance, it can be considered that a collision will occur in a short time, so the candidate obstacle object can be determined as an obstacle.
[0067] In some embodiments, the collision judgment box of the candidate obstacle object may be further compared with the height information of the target object to determine whether the candidate obstacle object is an obstacle. For example, the collision judgment box height information of the candidate obstacle object may be obtained; the chassis height information of the target object may be obtained; when the collision judgment box height information of the candidate obstacle object is greater than the chassis height information of the target object, the candidate obstacle object is determined to be an obstacle. In some embodiments, the chassis of the target object may be a planar component directly connected to its moving component (such as a wheel), and the chassis height information of the target object may be the distance from the chassis to the ground. In some embodiments, when the chassis height information of the target object is greater than or equal to the height information of the collision judgment box of the candidate obstacle object, even if the candidate obstacle object is located in the initial travel direction of the target object, the target object may pass over the candidate obstacle object, and therefore, the candidate obstacle object may not be listed as an obstacle, otherwise, the candidate obstacle object needs to be listed as an obstacle. For another example, the target object has functions such as leaping. In some embodiments, the leaping height information of the target object may be obtained. The leaping height information may be the maximum distance between the chassis of the target object and the ground when the target object leaps. In some embodiments, when the flying height information of the target object is greater than or equal to the height information of the collision judgment box of the candidate obstacle object, even if the candidate obstacle object is located in the initial travel direction of the target object, the target object can also fly over the candidate obstacle object. Therefore, the candidate obstacle object may not be listed as an obstacle. Otherwise, the candidate obstacle object needs to be listed as an obstacle.
[0068] In some embodiments, obstacle detection can be performed in real time in the virtual scene based on the initial direction of travel of the target object and a preset detection distance. Once an obstacle that meets the conditions is detected, steps 310 to 340 can be executed to assist the player in manipulating the target object to avoid the obstacle.
[0069] Figure 5 2 is a schematic diagram of the effect of controlling the movement of a target object using the target object control method shown in some embodiments of this specification. Figure 5 As shown, when the target object is controlled to move from the initial position A to the obstacle avoidance end position B according to the method shown in process 300, the obstacle avoidance is successfully avoided. Figure 5 After approaching the rock below (i.e. obstacle), a new round of obstacle detection can begin. Figure 5 The rocks on the upper side of the middle (which can be regarded as candidate obstacle objects) do not meet the conditions set in the obstacle detection method and will not trigger a new round of obstacle avoidance control process (such as step 310 to step 340).
[0070] Figure 6 3 is a schematic diagram of the effect of controlling the movement of a target object using the target object control method shown in some embodiments of this specification. Figure 6 As shown, when the target object is controlled to move from the initial position A to the obstacle avoidance end position B according to the method shown in process 300, the obstacle avoidance is successfully avoided. Figure 6 After the rock (i.e. obstacle) on the lower right side is detected, a new round of obstacle detection can begin. Figure 6 The rock on the upper left side of the image satisfies the conditions set in the obstacle detection method, thus triggering a new round of obstacle avoidance control process (such as steps 310 to 340), thereby allowing the vehicle to continue to avoid the rock on the upper left side.
[0071] In some embodiments, the user can flexibly set whether to turn on auxiliary control of the target object as needed. As an example, the user can set whether to turn on auxiliary control through the settings page of the game application or the game engine. After the user turns on the auxiliary setting, the computer device will simultaneously execute the control method shown in process 300 while running the game to assist the user in controlling the target object when necessary (such as detecting an obstacle). In other embodiments, the start of process 300 will also depend on other conditions, such as detecting that the user continues to trigger the forward control for a long time or at a high frequency while controlling the movement of the target object, or detecting that the target object or the virtual character it carries is in a combat state, etc.
[0072] In some embodiments, the computer device may execute the method described in process 300 in response to the time when the travel control corresponding to the target object is triggered exceeds a preset duration. As an example, the travel control may be a control that controls the movement of the target object, such as a forward control. When the player triggers the control, the target object can be controlled to move in a specified direction (such as directly in front of the target object) and at a certain speed. In some embodiments, the duration of the player triggering the travel control can be detected, and when it is detected that the player triggers the control and continues for more than a preset duration, the control process shown in process 300 can be started. Exemplarily, if it is detected that the player long presses the forward control for more than 10s, 20s or 30s, etc., the automatic obstacle detection and automatic obstacle avoidance control process described in some embodiments of this specification can be executed.
[0073] In some embodiments, the computer device may execute the method described in process 300 in response to the frequency of the forward control corresponding to the target object being triggered exceeding a preset frequency. In some embodiments, the player may control the target object to continuously move in a specified direction by frequently triggering the forward control. The preset frequency may be 0.5 times / s, 1 time / s, 5 times / s, etc. As an example, if it is detected that the player clicks the forward control at a higher frequency, such as 2 times / s, process 300 may be executed.
[0074] In some embodiments, the computer device may execute the method described in process 300 in response to the target object or the virtual character it carries being in a combat state. For example, the state information of the target object or the virtual character it carries can be obtained through the interface provided by the game engine, and based on the state information, it can be determined that the target object or the virtual character it carries is in a combat state. As an example, if it is detected that the target object is processing an attack state (such as firing bullets or shells), it can be determined that it is in a combat state. For example, if it is detected that the health of the virtual character carried by the target object is decreasing, it can be determined that the virtual character is processing a combat state. When the target object or the virtual character it carries is in a combat state, process 300 can assist the player in manipulating the target object to automatically avoid obstacles, which helps to improve the player's gaming experience.
[0075] Figure 5 is an exemplary block diagram of a target object control system according to some embodiments of this specification. Figure 5 As shown, the target object control system 700 may include an initial position determination module 710 , an obstacle avoidance end position determination module 720 , an obstacle avoidance trajectory determination module 730 , and a target object travel control module 740 .
[0076] The initial position determination module 710 is used to obtain the initial position information of the target object in response to the detection result of an obstacle detected in the virtual scene based on the initial moving direction of the target object and a preset detection distance.
[0077] The obstacle avoidance end position determination module 720 is used to determine the obstacle avoidance end position information based on the obstacle; wherein the obstacle avoidance end position enables the target object to move away from the obstacle when traveling at the obstacle avoidance end position according to the initial travel direction.
[0078] The obstacle avoidance trajectory determination module 730 is used to determine an obstacle avoidance driving trajectory based on the initial position information and the obstacle avoidance end position information.
[0079] The target object moving control module 740 is used to control the target object to move based on the obstacle avoidance driving trajectory so that the target object reaches the obstacle avoidance end position.
[0080] In some optional embodiments, the target object control system 700 may further include an obstacle detection module 750 for performing obstacle detection in the virtual scene based on the initial moving direction of the target object and a preset detection distance.
[0081] For more information about each module, see Figure 3 The relevant description of will not be repeated here. It should be understood that Figure 5 The system and its modules shown can be implemented in various ways. For example, in some embodiments, the system and its modules can be implemented by hardware, software, or a combination of software and hardware. Among them, the hardware part can be implemented using dedicated logic; the software part can be stored in a memory and executed by an appropriate instruction execution system, such as a microprocessor or dedicated design hardware. Those skilled in the art will understand that the above methods and systems can be implemented using computer executable instructions and / or control codes contained in a processor, such as a disk, CD or DVD-ROM, etc., and such codes are provided in a carrier medium or a memory of a programmable device. The system and its modules of this specification can not only be implemented by hardware circuits such as ultra-large-scale integrated circuits or gate arrays, semiconductors such as logic chips, transistors, etc., or programmable hardware devices such as field programmable gate arrays, programmable logic devices, etc., but can also be implemented by software executed by various types of processors, and can also be implemented by a combination of the above hardware circuits and software (e.g., firmware).
[0082] It should be noted that the above description of the system and its modules is only for convenience of description and does not limit this specification to the scope of the embodiments. It is understandable that for those skilled in the art, after understanding the principle of the system, it is possible to arbitrarily combine the modules without deviating from this principle to form a subsystem connected to other modules. Or some modules may be split to obtain more modules or multiple units under the module. Such variations are all within the scope of the disclosure of this specification.
[0083] Some embodiments of this specification also provide a computer program product, including computer instructions or computer codes, when at least part of the computer instructions or the computer codes are executed by a processor, the target object control method shown in some embodiments of this specification can be implemented. In some embodiments, the computer program product may only involve computer instructions or computer codes, which may be carried by a storage medium or a processing device. In other embodiments, the computer program product may also be a storage medium or a processing device containing the aforementioned computer instructions or computer codes. The processing device may include one or more processors, and a storage medium.
[0084] In some embodiments, the processor may be a combination of one or more of the following processors: a central processing unit (CPU), an application specific integrated circuit (ASIC), an application specific instruction set processor (ASIP), a graphics processing unit (GPU), a physical processing unit (PPU), a digital signal processor (DSP), a field programmable gate array (FPGA), a programmable logic device (PLD), a programmable logic controller (PLC), a reduced instruction set computer (RISC), and a microprocessor.
[0085] In some embodiments, the storage medium may include a combination of one or more of the following: a mass storage, a removable storage, a volatile read-write memory, and a read-only memory (ROM). Exemplary mass storage may include a magnetic disk, an optical disk, a solid-state hard disk, and the like. Exemplary removable storage may include a flash disk, a floppy disk, an optical disk, a memory card, a compressed hard disk, a magnetic tape, and the like. Exemplary volatile read-write memory may include a random access memory (RAM). Exemplary random access memory may include a dynamic random access memory (DRAM), a double data rate synchronous dynamic random access memory (DDRSDRAM), a static random access memory (SRAM), a thyristor random access memory (T-RAM), and a zero capacitance memory (Z-RAM), and the like. Exemplary read-only memory may include a masked read-only memory (MROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), a compact disk read-only memory (CD-ROM), and a digital multifunction hard disk read-only memory, and the like.
[0086] The beneficial effects that may be brought about by the embodiments of this specification include but are not limited to: (1) By dynamically calculating the obstacle avoidance driving path, the target object can automatically avoid obstacles, and the player can operate the target object more smoothly to avoid accidental collisions, thereby improving the playability and player experience of the game. (2) When an obstacle is detected, the control of the target object is taken over, and the player is automatically restored when the target object drives away from the obstacle, ensuring the player's operability while avoiding accidental collisions. (3) The obstacle avoidance driving trajectory is determined based on the curve segment (specifically, such as the monotonic curve segment), and the smooth driving of the target object is ensured during the obstacle avoidance control process, which improves the player experience. (4) Obstacle detection is performed based on the target travel direction and the preset detection distance, which helps to improve the accuracy and timeliness of detection. It should be noted that different embodiments may produce different beneficial effects. In different embodiments, the beneficial effects that may be produced may be any one or a combination of the above, or any other beneficial effects that may be obtained.
[0087] The basic concepts have been described above. Obviously, for those skilled in the art, the above detailed disclosure is only for example and does not constitute a limitation of this specification. Although not explicitly stated here, those skilled in the art may make various modifications, improvements and corrections to this specification. Such modifications, improvements and corrections are taught in this specification, so such modifications, improvements and corrections still belong to the spirit and scope of the exemplary embodiments of this specification.
Claims
1. A target object control method, characterized in that: include: In response to a detection result of an obstacle being detected in the virtual scene based on an initial moving direction of the target object and a preset detection distance, acquiring initial position information of the target object; Determining obstacle avoidance end position information based on the obstacle; wherein the obstacle avoidance end position enables the target object to move away from the obstacle when traveling at the obstacle avoidance end position according to the initial travel direction; Determining an obstacle avoidance driving trajectory based on the initial position information and the obstacle avoidance end position information; The target object is controlled to move based on the obstacle avoidance driving trajectory so that the target object reaches the obstacle avoidance end position.
2. The method according to claim 1, characterized in that: The determining the obstacle avoidance end position information based on the obstacle includes: Determine a first straight line that passes through the center point of the obstacle and is perpendicular to the initial driving direction; Determine a first point on the first straight line; wherein the distance between the first point and the center point is not less than a preset anti-collision threshold; The obstacle avoidance end position information is determined based on the first point.
3. The method according to claim 1, characterized in that The determining of the obstacle avoidance driving trajectory based on the initial position information and the obstacle avoidance end position information includes: The obstacle avoidance driving trajectory is determined based on a curve segment connecting an initial position corresponding to the initial position information and the obstacle avoidance end position.
4. The method according to claim 3, characterized in that The curve segment is a monotonic curve segment.
5. The method according to claim 4, characterized in that The curve segment is a monotone cosine curve segment or a monotone sine curve segment within half a period.
6. The method according to claim 1, characterized in that The controlling the target object to move based on the obstacle avoidance driving trajectory so that the target object reaches the obstacle avoidance end position includes: Determine a second travel position component of the target object based on the obstacle avoidance driving trajectory and the first travel position component of the target object; wherein the first travel position component reflects the travel position information of the target object in the initial travel direction, and the second position component reflects the travel position information of the target object in a direction perpendicular to the initial travel direction; The target object is controlled to travel based on the first travel position component and the second travel position component so that the target object reaches the obstacle avoidance end position.
7. The method according to claim 6, characterized in that The determining, based on the obstacle avoidance driving trajectory and the first travel position component of the target object, a second travel position component of the target object comprises: Determine a curve equation corresponding to the obstacle avoidance driving trajectory, wherein the curve equation has a first variable and a second variable; Taking the first travel position component as the variable value of the first variable, solving the curve equation to obtain the variable value of the second variable; The second travel position component is determined based on a variable value of the second variable.
8. The method according to claim 1, characterized in that The method also includes performing obstacle detection in the virtual scene based on the initial travel direction of the target object and a preset detection distance.
9. The method according to claim 8, characterized in that The obstacle detection is performed in the virtual scene based on the initial moving direction of the target object and the preset detection distance, including: Determining a beam of rays along the initial direction of travel based on the current position of the target object; wherein a width of the beam of rays is related to a width of the target object; When the distance between the overlapping area of the ray beam and the collision judgment box of the candidate obstacle object in the virtual scene and the current position of the target object is less than the preset detection distance, the obstacle is determined based on the candidate obstacle object; wherein the collision judgment box of the candidate obstacle object is determined based on the boundary of the candidate obstacle object.
10. The method according to claim 9, characterized in that The determining the obstacle based on the candidate obstacle object further includes: obtaining collision determination box height information of the candidate obstacle object; obtaining chassis height information of the target object; when the collision determination box height information is greater than the chassis height information, determining the candidate obstacle object as the obstacle; Or further comprising: obtaining collision judgment box height information of the candidate obstacle object; obtaining flight height information of the target object; and when the collision judgment box height information is greater than the flight height information, determining the candidate obstacle object as the obstacle.
11. A target object control method, characterized in that: include: In response to a preset condition being met, the method described in any one of claims 1 to 10 is executed; wherein the preset condition includes one or more of the following conditions: the time when the travel control corresponding to the target object is triggered exceeds a preset duration, the frequency when the travel control corresponding to the target object is triggered exceeds a preset frequency, and the target object or the virtual character it carries is in a combat state.
12. A target object control system, characterized in that: include: An initial position determination module, configured to obtain initial position information of the target object in response to a detection result of an obstacle detected in a virtual scene based on an initial moving direction of the target object and a preset detection distance; An obstacle avoidance end position determination module, configured to determine obstacle avoidance end position information based on the obstacle; wherein the obstacle avoidance end position enables the target object to move away from the obstacle when traveling at the obstacle avoidance end position according to the initial travel direction; An obstacle avoidance trajectory determination module, used to determine an obstacle avoidance driving trajectory based on the initial position information and the obstacle avoidance end position information; The target object travel control module is used to control the target object to travel based on the obstacle avoidance driving trajectory so that the target object reaches the obstacle avoidance end position.
13. A computer program product, comprising computer codes, which, when at least part of the computer codes are executed by a processor, can implement the method according to any one of claims 1 to 11.
