Object control method and device, storage medium and electronic device
By adjusting the landing horizontal distance of virtual objects in 3D game applications, the control accuracy problem of virtual objects when climbing or climbing obstacles is solved, achieving higher control accuracy and success rate.
Patent Information
- Application Number
- CN202111163386.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-09-30
- Publication Date
- 2025-08-12
- Estimated Expiration
- 2041-09-30
AI Technical Summary
In 3D game applications, virtual objects have low control accuracy when climbing or climbing obstacles, resulting in frequent failures.
By displaying the virtual scene in the display interface, in response to the action key operation, the first landing horizontal distance of the target virtual object is determined, and when the obstacle matching condition is not met, it is adjusted to the second landing horizontal distance to ensure that the target action can successfully pass through the obstacle.
Improves the accuracy of the control of virtual objects through obstacles, avoids failure in action execution, and improves the game experience.
Smart Images

Figure CN113893546B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computers, and in particular to an object control method and device, a storage medium, and an electronic device. Background Art
[0002] With the development of the Internet and computer hardware, more and more users have begun downloading and using various types of game applications (APPs) in recent years. To provide players with an immersive gaming experience, game developers have developed many three-dimensional (3D) game applications that simulate real-world scenarios.
[0003] In the virtual scenes provided by 3D gaming applications, when a player-controlled virtual object needs to climb or traverse obstacles set in the game, it often performs the climbing or traversing action based on the type of collision box configured for the obstacle. However, due to the complexities often present in virtual scenes, such as uneven or narrow upper surfaces, the controlled virtual object can easily fail to climb or traverse.
[0004] That is, in the process of controlling a virtual object to climb over or over an obstacle provided by the related art, there is a problem of low control accuracy.
[0005] To address the above-mentioned problems, no effective solutions have been proposed so far. Summary of the Invention
[0006] Embodiments of the present invention provide an object control method and apparatus, a storage medium, and an electronic device to at least solve the technical problem of low control accuracy when controlling a virtual object to pass through an obstacle.
[0007] According to one aspect of an embodiment of the present invention, there is provided an object control method, comprising: displaying a virtual scene in a display interface, wherein the virtual scene includes a target virtual object and a target virtual obstacle; determining, in response to an operation performed on an action button displayed in the display interface, a first landing horizontal distance configured for a target action to be performed by the target virtual object; and, if the first landing horizontal distance does not satisfy a landing condition matching the target virtual obstacle, controlling the target virtual object to perform the target action according to a second landing horizontal distance to pass through the target virtual obstacle, wherein the second landing horizontal distance satisfies the landing condition.
[0008] According to another aspect of an embodiment of the present invention, an object control device is also provided, including: a display unit for displaying a virtual scene in a display interface, wherein the virtual scene includes a target virtual object and a target virtual obstacle; a determination unit for determining, in response to an operation performed on an action button displayed in the display interface, a first landing horizontal distance configured for a target action to be performed by the target virtual object; and a control unit for controlling the target virtual object to perform the target action according to a second landing horizontal distance to pass through the target virtual obstacle when the first landing horizontal distance does not meet a landing condition matching the target virtual obstacle, wherein the second landing horizontal distance meets the landing condition.
[0009] According to another aspect of the embodiments of the present invention, a computer-readable storage medium is provided, in which a computer program is stored. The computer program is configured to execute the object control method when running.
[0010] According to another aspect of the embodiments of the present application, a computer program product is provided, comprising a computer program / 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 executes the computer instructions, causing the computer device to perform the object control method described above.
[0011] According to another aspect of an embodiment of the present invention, an electronic device is provided, including a memory and a processor, wherein the memory stores a computer program, and the processor is configured to execute the object control method through the computer program.
[0012] In an embodiment of the present invention, a virtual scene including a target virtual object and a target virtual obstacle is displayed on a display interface. In response to an operation performed on an action button displayed on the display interface, a first landing horizontal distance configured for a target action to be performed by the target virtual object is determined. If the first landing horizontal distance does not meet a landing condition matching the target virtual obstacle, the first landing horizontal distance is adjusted to a second landing horizontal distance that meets the landing condition, and the target virtual object is controlled to perform the target action according to the second landing horizontal distance to pass through the target virtual obstacle. In other words, the first landing horizontal distance configured for the target action to be performed by the target virtual object is compared with the landing condition matching the target virtual obstacle. If the first landing horizontal distance does not meet the landing condition, the first landing horizontal distance is adjusted to the second landing horizontal distance, and the target action is performed according to the adjusted second landing horizontal distance to pass through the target virtual obstacle, thereby avoiding the situation where the action execution fails, thereby improving the control accuracy of the target virtual object, and thereby overcoming the problem of low virtual object control accuracy existing in the related art. BRIEF DESCRIPTION OF THE DRAWINGS
[0013] The drawings described herein are used to provide a further understanding of the present invention and constitute a part of this application. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation of the present invention. In the drawings:
[0014] Figure 1 is a schematic diagram of a hardware environment of an optional object control method according to an embodiment of the present invention;
[0015] Figure 2 is a flow chart of an optional object control method according to an embodiment of the present invention;
[0016] Figure 3 is a schematic diagram of an optional object control method according to an embodiment of the present invention;
[0017] Figure 4 is a schematic diagram of another optional object control method according to an embodiment of the present invention;
[0018] Figure 5 is a schematic diagram of another optional object control method according to an embodiment of the present invention;
[0019] Figure 6 is a schematic diagram of another optional object control method according to an embodiment of the present invention;
[0020] Figure 7 is a schematic diagram of another optional object control method according to an embodiment of the present invention;
[0021] Figure 8is a schematic diagram of another optional object control method according to an embodiment of the present invention;
[0022] Figure 9 is a flow chart of another optional object control method according to an embodiment of the present invention;
[0023] Figure 10 is a schematic structural diagram of an optional object control device according to an embodiment of the present invention;
[0024] Figure 11 FIG. 4 is a schematic structural diagram of an optional electronic device according to an embodiment of the present invention. DETAILED DESCRIPTION
[0025] In order to enable those skilled in the art to better understand the solutions of the present invention, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the embodiments described are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts should fall within the scope of protection of the present invention.
[0026] It should be noted that the terms "first", "second", etc. in the description and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that the numbers used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0027] According to one aspect of an embodiment of the present invention, an object control method is provided. Optionally, as an optional implementation, the object control method can be applied to, but is not limited to, Figure 1 The object control system in the hardware environment shown in FIG. 1 includes, but is not limited to, a terminal device 102, a network 104, a server 106, and a database 108. The terminal device 102 runs a target client (e.g., Figure 1 The target client is shown as a game client. The terminal device 102 includes a human-computer interaction screen, a processor and a memory. The human-computer interaction screen is used to display the virtual scene provided in the game application (such as Figure 1The virtual scene shown is a simulation-type battle game scene, which includes a target virtual object and a target virtual obstacle. The device is also configured to provide a human-computer interaction interface for receiving human-computer interaction operations for controlling a controlled virtual object in the virtual scene. The virtual object will then perform actions according to the instructions to complete the game tasks set in the virtual scene. The processor is configured to generate interaction instructions in response to the human-computer interaction operations and transmit the interaction instructions to a server. The memory is configured to store relevant attribute data, such as character attribute information of the controlled virtual object and attribute information of the target virtual obstacle. This attribute information may include, but is not limited to, information such as the position, height, and width of the target virtual obstacle.
[0028] In addition, the server 106 includes a processing engine configured to perform storage or reading operations on the database 108. Specifically, the processing engine reads the landing condition matching the target virtual obstacle from the database 108 to determine whether the first landing horizontal distance configured for the target action to be performed by the target virtual character satisfies the landing condition.
[0029] The specific process is as follows: In step S102, a virtual scene (such as Figure 1 The virtual scene shown in (a) includes a target virtual object 100 and a target virtual obstacle 101. In step S104, in response to an operation performed on an action button displayed on the display interface, a first landing horizontal distance configured for the target action to be performed by the target virtual object is determined. Then, step S106 is executed to send the first landing horizontal distance configured for the target action via the network 104 to the server 106. It should be noted that an action identifier of the target action may also be sent to the server 106 via the network 104, so that the server 106 determines the first landing horizontal distance pre-configured for the target action based on the action identifier.
[0030] After obtaining the first landing horizontal distance, server 106 executes steps S108-S112: determining whether the first landing horizontal distance satisfies the landing condition matching the target virtual obstacle; and if the first landing horizontal distance does not meet the landing condition, server 106 determines a second landing horizontal distance that does meet the landing condition. The server then returns the second landing horizontal distance to terminal device 102 via network 104.
[0031] The terminal device 102 will execute step S114 to control the target virtual object to perform the target action according to the second landing horizontal distance to pass through the target virtual obstacle. Figure 1 The dotted line shown in (b) is an action trajectory line, which is used to indicate that the target virtual object 100 performs a target action such as overturning or climbing according to the second landing horizontal distance to pass through the target virtual obstacle 101.
[0032] As another optional implementation, when the terminal device 102 has relatively powerful computing and processing capabilities, the above steps S108-S110 can also be completed independently by the terminal device 102. This is just an example and is not limited in this embodiment.
[0033] It should be noted that in this embodiment, a virtual scene including a target virtual object and a target virtual obstacle is displayed on a display interface. In response to an operation performed on an action button displayed on the display interface, a first landing horizontal distance configured for a target action to be performed by the target virtual object is determined. If the first landing horizontal distance does not meet the landing condition matching the target virtual obstacle, the first landing horizontal distance is adjusted to a second landing horizontal distance that meets the landing condition, and the target virtual object is controlled to perform the target action according to the second landing horizontal distance to pass the target virtual obstacle. In other words, the first landing horizontal distance configured for the target action to be performed by the target virtual object is compared with the landing condition matching the target virtual obstacle. If the first landing horizontal distance does not meet the landing condition, the first landing horizontal distance is adjusted to the second landing horizontal distance, and the target action is performed according to the adjusted second landing horizontal distance to pass the target virtual obstacle, thereby avoiding action execution failure and improving the control accuracy of the target virtual object, thereby overcoming the low control accuracy of virtual objects existing in the related art.
[0034] Optionally, in this embodiment, the terminal device may be a terminal device configured with a target client, including but not limited to at least one of the following: a mobile phone (such as an Android phone, iOS phone, etc.), a laptop, a tablet computer, a PDA, an MID (Mobile Internet Device), a PAD, a desktop computer, a smart TV, etc. The target client may be a video client, an instant messaging client, a browser client, an educational client, etc., configured with a plug-in or program for a target game application. In the virtual scene provided by the target game application, it is necessary to control a virtual object to simulate and perform a target action to accurately pass through adjacent virtual obstacles. The network may include but is not limited to: a wired network and a wireless network, wherein the wired network includes: a local area network, a metropolitan area network, and a wide area network, and the wireless network includes: Bluetooth, Wi-Fi, and other networks that enable wireless communication. The server may be a single server, a server cluster consisting of multiple servers, or a cloud server. The above is merely an example and is not limited in this embodiment.
[0035] Optionally, in this embodiment, the object control method can be applied to, but is not limited to, a gaming terminal application (Application, APP) that completes a predetermined competitive game task in a virtual scene, such as a shooting game application in a multiplayer online tactical competitive game (MOBA) application, wherein the competitive game task can be, but is not limited to, a game task completed by the current player controlling a virtual character in a virtual scene through human-computer interaction and interacting with virtual characters controlled by other players. The competitive game task here can be, but is not limited to, running in an application (such as a non-independent game APP) in the form of a plug-in or applet, or running in an application (such as an independent game APP) in a game engine. The types of the game applications can include, but are not limited to, at least one of the following: two-dimensional (2D) game applications, three-dimensional (3D) game applications, virtual reality (VR) game applications, augmented reality (AR) game applications, and mixed reality (MR) game applications. The above is only an example, and this embodiment does not impose any limitation on this.
[0036] Alternatively, as an optional implementation, Figure 2 As shown, the above object control method includes:
[0037] S202, displaying a virtual scene on a display interface, wherein the virtual scene includes a target virtual object and a target virtual obstacle;
[0038] Optionally, in this embodiment, the virtual scene may be, but is not limited to, a virtual game scene provided by a game application, such as a multiplayer online competitive shooting game application. The shooting application may include, but is not limited to, first-person shooting games (FPS), third-person shooting games (TPS), and other games that use firearms for long-range attacks, including but not limited to these. First-person shooting applications are a branch of action games (ACT). As the name suggests, first-person shooting applications are shooting applications that use the operator's (player's) subjective perspective to shoot. Third-person shooting applications are also a type of shooting application. The difference from first-person shooting applications is that the virtual control objects controlled by the operator (player) are directly displayed in the virtual scene screen. In other words, third-person shooting is a running screen captured by a virtual camera set in the virtual scene, thereby presenting the third-person perspective observation screen.
[0039] Optionally, in this embodiment, the above-mentioned target virtual object can be but is not limited to a virtual object controlled by the current client. The virtual object can be but is not limited to a virtual human character, a virtual animal image, a virtual cartoon image, etc., which is used to represent the player to complete the shooting task in the virtual scene.
[0040] Optionally, in this embodiment, the target virtual obstacle may be, but is not limited to, an obstacle in the virtual scene that blocks the target virtual object from moving forward, such as a virtual slope, a virtual terrace or platform, a virtual vehicle, a virtual bunker, a virtual railing, etc. This embodiment does not impose any restrictions on the type of the target virtual obstacle.
[0041] S204, in response to an operation performed on an action button displayed in the display interface, determining a first landing horizontal distance configured for a target action to be performed by the target virtual object;
[0042] Optionally, in this embodiment, the target action to be performed to pass a target virtual obstacle may include, but is not limited to, a climbing action or a hopping action. That is, when the target virtual object encounters a target virtual obstacle of a certain height on its path, the target virtual object may perform a climbing action to climb the target virtual obstacle to continue moving forward. Alternatively, when the target virtual object encounters a target virtual obstacle of a certain width on its path, the target virtual object may perform a hopping action to hop over the target virtual obstacle to continue moving forward.
[0043] Furthermore, in this embodiment, the landing horizontal distance configured for the target action may be, but is not limited to, the horizontal distance between the landing position of the target virtual object after executing the target action and the position of the target virtual object before executing the target action. The landing horizontal distance may be, but is not limited to, a default value pre-configured for the target action by the game application.
[0044] It should be noted that in this embodiment, the collision box attribute information configured for the target virtual obstacle can be used, but is not limited to, to indicate whether the target virtual obstacle is a climbing obstacle or a climbing obstacle. The collision box attribute information includes, but is not limited to, the collision box's location information and collision box size information.
[0045] For example, Figure 3 The virtual scene shown includes a target virtual object 302 and a target virtual obstacle 304. According to the collision box attribute information of the target virtual obstacle 304, it is determined that it is a climbing obstacle. Then, in response to the target action (climbing action), the target virtual obstacle 304 is crossed. Figure 3 If the target virtual object 302 can successfully climb over the target virtual obstacle 304, the target virtual object 302 will climb over the target virtual obstacle 304 from position A along the direction of action indicated by the dashed line to position B on the other side. The width of the target virtual obstacle is L1 and the height is H1. The default landing horizontal distance preconfigured for the climbing action is the horizontal distance d1 between position A and position B.
[0046] For example, Figure 4 The virtual scene shown includes a target virtual object 302 and a target virtual obstacle 304. According to the collision box attribute information of the target virtual obstacle 304, it is determined that it is a climbing obstacle. Then, in response to the target action (climbing action), the target virtual obstacle 304 is crossed. Figure 3 If the target virtual object 302 can successfully climb the target virtual obstacle 304, it will climb from position A along the direction of action indicated by the dashed line to position C above the target virtual obstacle 304. The target virtual obstacle has a width of L2 and a height of H2. The default landing horizontal distance preconfigured for the above climbing action is the horizontal distance d2 between position A and position C.
[0047] S206 , when the first landing horizontal distance does not meet the landing condition matching the target virtual obstacle, controlling the target virtual object to perform the target action according to the second landing horizontal distance to pass through the target virtual obstacle, wherein the second landing horizontal distance meets the landing condition.
[0048] Optionally, in this embodiment, the above landing condition may, but is not limited to, be used to indicate the landing interval formed by the positions where the target virtual obstacle allows landing. The landing interval may, but is not limited to, be determined according to the width of the target virtual obstacle and whether there are other obstacles adjacent to the periphery of the target virtual obstacle.
[0049] For example, assuming as shown in Figure 5 , taking a climbing obstacle as an example, the target virtual object is located on one side of the obstacle S1, and there is another obstacle S2 on the other side of the obstacle S1. The width of the upper surface of the obstacle S1 that allows landing after a climbing action is d3, but the default landing horizontal distance (i.e., the first landing horizontal distance) configured for the climbing action performed by the target virtual object 302 is the distance d2, where d3 < d2. That is, in the above Figure 5 shown scenario, the first landing horizontal distance (i.e., d2) of the target virtual object does not meet the landing condition (within the interval indicated by d3) matching the target virtual obstacle.
[0050] Furthermore, the above default landing horizontal distance can be adjusted, such as adjusting the distance d2 to the distance d4, and then controlling the target virtual object to perform the climbing action according to the distance d4 to reach the upper surface of the obstacle S1, and continue to move forward in the moving mode supported on the obstacle S1 to achieve the purpose of passing through the obstacle. Among them, the distance d4 is a distance value less than the distance d3 (such as d4 = 0.5 * d3), so that after the target virtual object climbs, it will not hit the obstacle S2 or even get half - body stuck in the obstacle S2, thereby improving the accuracy of controlling the target virtual object to execute the target action to pass through the obstacle.
[0051] The above Figure 3-Figure 5 is shown as an example, and this embodiment does not make any limitations thereto.
[0052] According to the embodiments provided by the present application, a virtual scene including a target virtual object and a target virtual obstacle is displayed on a display interface. In response to an operation performed on an action button displayed on the display interface, a first landing horizontal distance configured for a target action to be performed by the target virtual object is determined. If the first landing horizontal distance does not meet the landing condition that matches the target virtual obstacle, the first landing horizontal distance is adjusted to a second landing horizontal distance that meets the landing condition, and the target virtual object is controlled to perform the target action according to the second landing horizontal distance to pass through the target virtual obstacle. In other words, the first landing horizontal distance configured for the target action to be performed by the target virtual object is compared with the landing condition that matches the target virtual obstacle. If the first landing horizontal distance does not meet the landing condition, the first landing horizontal distance is adjusted to the second landing horizontal distance, and the target action is performed according to the adjusted second landing horizontal distance to pass through the target virtual obstacle, thereby avoiding the situation where the action execution fails, thereby improving the control accuracy of the target virtual object, and thus overcoming the problem of low control accuracy of virtual objects existing in the related art.
[0053] As an optional solution, when determining the first landing horizontal distance configured for the target action to be performed by the target virtual object, the method further includes:
[0054] S1, obtaining the reference landing interval required for the target virtual object to pass through the target virtual obstacle;
[0055] S2: When the first landing horizontal distance is not within the reference landing interval, determine that the first landing horizontal distance does not meet a landing condition matching the target virtual obstacle.
[0056] Optionally, in this embodiment, the reference landing interval may be determined based on, but not limited to, at least one of the following information: a span width of the target virtual obstacle, and a positional relationship between other obstacles adjacent to the target virtual obstacle and the target virtual obstacle.
[0057] For example, Figure 5 As shown, assuming the target virtual object climbs an obstacle, the obstacle's reference landing range may be affected by, but is not limited to, the positional relationship between other obstacles and the target virtual obstacle. For example, if the width of the upper surface of obstacle S1 allowing landing after a climbing action is d3, if the default landing horizontal distance (i.e., the first landing horizontal distance) d2 configured for the climbing action performed by the target virtual object 302 is greater than this distance d3, it indicates that the target virtual object does not meet the landing conditions for virtual vehicle matching. The range within this distance d3 is the reference landing range for obstacle S1 in this scenario.
[0058] For example, Figure 6As shown, it is assumed that climbing obstacles (such as Figure 6 For example, the target virtual object 602 is about to climb to the roof of the virtual vehicle 604 (as shown in FIG. Figure 6 (The area filled with diagonal lines in the middle). The roof surface area of virtual vehicle 604 is relatively small. Assume that the width allowed for landing after the climbing action is d5, but the distance between target virtual object 602 and virtual vehicle 604 is d0. Assume that the default landing horizontal distance (i.e., the first landing horizontal distance) configured for the climbing action performed by the target virtual object is still distance d2.
[0059] In the above Figure 6 In the example shown, the reference landing interval can be the distance range from d0 to d0+d5. Figure 6 In the scenario shown, when the first landing horizontal distance of the target virtual object (i.e., d2) is within the distance range between d0 and d0+d5 (reference landing interval), it means that the target virtual object meets the landing conditions for virtual vehicle matching; and when the first landing horizontal distance of the target virtual object (i.e., d2) is less than d0, or greater than d0+d5, it means that the target virtual object does not meet the landing conditions for virtual vehicle matching.
[0060] Through the embodiments provided herein, after obtaining the reference landing interval required for the target virtual object to pass through the target virtual obstacle, if the first landing horizontal distance is not within the reference landing interval, it can be determined that the first landing horizontal distance does not meet the landing conditions matching the target virtual obstacle. Based on the reference landing interval of the target virtual obstacle, it is determined whether the target action currently to be performed by the target virtual object requires adjustment of the landing horizontal distance, thereby ensuring the accuracy of the landing position and preventing the target virtual object from displaying distorted content due to the inserted obstacle.
[0061] As an optional solution, obtaining the reference landing interval required when the target virtual object passes through the target virtual obstacle includes:
[0062] S1, constructing a first ray for obstacle detection with the target virtual object as the starting point and the direction of the target virtual object as the extension direction;
[0063] S2, performing collision detection on the target virtual obstacle using the first ray to obtain a collision detection result;
[0064] S3, when the collision detection result indicates that the extension direction of the first ray also includes a reference obstacle, obtaining a collision distance between the target virtual object and the reference obstacle;
[0065] S4: Determine the distance interval indicated by the collision distance as a reference landing interval.
[0066] Specific combination Figure 7 The example shown is used for explanation: Assume that the head of the target virtual object 702 is used as the starting point, and the direction of the target virtual object 702 is used as the extension direction to construct the Figure 7 The horizontal rightward ray shown in is used for collision detection to obtain a collision detection result.
[0067] Combine Figure 7 As shown, when the collision detection result indicates that the extension direction of the ray also includes a reference obstacle 706 (such as a wall including a window as shown in the figure), it means that when the target virtual object 702 climbs to the target virtual obstacle 704 (such as the terrace as shown in the figure), its landing horizontal distance will be affected by the reference obstacle 706.
[0068] Assume that the default landing distance for target virtual object 702 when performing a climbing action is 3 meters, and the collision detection result obtained based on ray detection indicates that the collision distance between target virtual object 702 and reference obstacle 706 is 2 meters (m), that is, the width of the passageway of target virtual obstacle 704 is 2 meters. Here, based on the guardrail of target virtual obstacle 704 (the terrace shown in the figure) (on the side where the target virtual object is located), the range within the above 2 meters can be determined as the reference landing range for target virtual obstacle 704 (the terrace shown in the figure).
[0069] Through the embodiment provided by the present application, the first ray constructed based on the position and orientation of the target virtual object is used to perform collision detection on the target virtual obstacle. This allows the collision distance between the target virtual object and the reference obstacle to be obtained based on the reference obstacle indicated by the collision detection result, and further determines the reference landing interval for the target virtual obstacle to be matched based on the distance interval indicated by the collision distance. This allows the collision distance obtained based on the ray detection to be used to accurately determine the reference landing interval in which the target virtual object is allowed to land, and then determines the landing horizontal distance that the target virtual object relies on when performing the target action based on the reference landing interval, thereby achieving the effect of controlling the target virtual object to accurately complete the action according to the above-calculated landing horizontal distance.
[0070] As an optional solution, after using the first ray to perform collision detection on the target virtual obstacle and obtaining the collision detection result, it also includes: when the collision detection result indicates that the extension direction of the first ray does not include the reference obstacle, but the first landing horizontal distance is greater than the width of the target virtual obstacle, the distance interval indicated by the width of the target virtual obstacle is determined as the reference landing interval.
[0071] It should be noted that, in this embodiment, when the width of the target virtual obstacle is less than or equal to the first landing horizontal distance, the reference landing interval within which the target virtual object is allowed to land can be determined based on, but not limited to, the distance interval indicated by the width of the target virtual obstacle. Figure 6 The content and related examples shown will not be repeated here.
[0072] Through the embodiments provided in the present application, a reference landing interval in which the target virtual object is allowed to land is determined based on the distance interval indicated by the width of the above-mentioned target virtual obstacle, and then the landing horizontal distance that the target virtual object relies on when performing the target action is determined based on the reference landing interval, thereby achieving the effect of controlling the target virtual object to accurately complete the action according to the above-calculated landing horizontal distance.
[0073] As an optional solution, the first ray is used to perform collision detection on the target virtual obstacle, and the collision detection results include:
[0074] S1, determining the detection distance according to the first landing horizontal distance;
[0075] S2, performing collision detection on the target virtual obstacle according to the detection distance.
[0076] It should be noted that raycasting is used to detect objects encountered and the location of the collision, and returns the collision distance. However, since the target action is configured with a default first horizontal landing distance, this embodiment can determine the detection distance based on, but is not limited to, the first horizontal landing distance. Then, raycasting is performed using the first ray according to the detection distance, eliminating the need to detect content outside the detection distance range, thereby reducing performance consumption.
[0077] Optionally, in this embodiment, the detection distance may be, but is not limited to, equal to the first horizontal distance to the ground, or may be, but is not limited to, based on the product of a preset weight and the first horizontal distance to the ground. The preset weight may be, but is not limited to, flexibly configured based on actual detection needs, and this embodiment does not impose any restrictions on this.
[0078] Through the embodiments provided in this application, collision detection is performed on the target virtual obstacle according to the detection distance determined according to the first landing horizontal distance, thereby reducing the range of ray detection and achieving the purpose of reducing detection performance consumption.
[0079] As an optional solution, when controlling the target virtual object to perform the target action according to the second landing horizontal distance, the method further includes:
[0080] S1, determining the contact position between the target virtual object and the target virtual obstacle;
[0081] S2. Obtain the height corresponding to the contact position of the target virtual obstacle.
[0082] S3. Control the target virtual object to perform the target action according to the height.
[0083] Optionally, in this embodiment, when the target virtual object passes through the target virtual obstacle, it not only needs to rely on the landing horizontal distance, but also can, but is not limited to, rely on the action height. It should be noted that in the related art, the average height of the target virtual obstacle is often used as the reference height for controlling the target virtual object to perform actions.
[0084] For example, taking climbing the target virtual obstacle to pass through as an example, when the target virtual obstacle is an inclined object, its height on one side is h1 and the height on the other side is h2, where h1 > h2. Therefore, when the target virtual object climbs at position K on one side of the target virtual obstacle, the climbing height obtained is still the height h0 of the center position of the target virtual obstacle, where h0 = (h1 + h2) / 2. When climbing according to h0, if hk < h0, the target virtual object will fail to climb to the upper surface of the target virtual obstacle because the control height of the climbing action is less than h0; if hk > h0, the target virtual object will show a distorted performance of staying in the air for a while and then falling.
[0085] Through the embodiment provided by this application, it is possible to accurately determine the height corresponding to the contact position between the target virtual object and the target virtual obstacle, and then control the target virtual object to accurately perform the target action according to the height corresponding to the contact position. Thus, it is possible to avoid situations such as being unable to reach or distortion in the related art, and further ensure the accuracy of controlling the target virtual object to perform the target action to pass through the target virtual obstacle.
[0086] As an optional solution, obtaining the height corresponding to the contact position of the target virtual obstacle includes:
[0087] S1. Construct a second ray for height detection in the vertical direction.
[0088] S2. Use the second ray to detect the height at the contact position of the target virtual obstacle to obtain a height detection result.
[0089] S3. Obtain the height corresponding to the contact position from the height detection result.
[0090] Specifically combined with Figure 8As an example, assume that a second ray for height detection is constructed in a vertical direction. This second ray is used to detect the height of the contact position P between the target virtual object 802 and the target virtual obstacle (such as the slope shown in the figure) 804. Assuming the height detection result indicates H, the target virtual object 802 can be controlled to jump at the height H to complete the target action, instead of using the center position height as the control height for the target action.
[0091] The embodiments provided herein utilize a second ray constructed in a vertical direction to detect the height of a target virtual obstacle. This allows the target virtual object to be controlled to complete a target action based on the height indicated by the height detection result, ensuring that the target virtual object is accurately controlled to complete the action, thereby overcoming the distortion experienced in related technologies.
[0092] As an optional solution, before controlling the target virtual object to perform the target action according to the second landing horizontal distance, the method further includes:
[0093] 1) In response to an operation on a climbing action button displayed in the display interface, determining that the target action to be performed by the target virtual object is a climbing action; or
[0094] 2) In response to an operation performed on a flipping action button displayed in the display interface, determining that a target action to be performed by the target virtual object is a flipping action.
[0095] It should be noted that, in this embodiment, the above-mentioned target virtual obstacle passing method may include but is not limited to one of the following: climbing over, climbing over, and the corresponding target action may include but is not limited to climbing over, and target action.
[0096] Specific combination Figure 9 The example shown here fully describes the process of the object control method provided in the embodiment of the present application. Assume that the currently displayed virtual scene includes a target virtual object and a target virtual obstacle:
[0097] In step S902, the target virtual object in the virtual scene moves near an obstacle. Next, a determination is made as to whether a click operation on the "jump" action button has been detected, as in step S904. If such a click operation is detected, step S906 is executed. If such a click operation is not detected, the process returns to the process before step S902.
[0098] In step S906, a ray is cast forward based on the location of the target virtual object to perform collision detection, and in step S908, it is determined whether there is an obstacle ahead based on the collision detection result. If an obstacle is detected, step S910-1 is executed; if no obstacle is detected, step S910-2 is executed.
[0099] In step S910-1, the distance (i.e., collision distance) between the target virtual object (e.g., a character) and the obstacle ahead of the ray is obtained. Here, the horizontal distance required for the action to pass through the obstacle (i.e., the first landing horizontal distance) is adjusted based on the collision distance to obtain a second landing horizontal distance that satisfies the landing condition, thereby accurately completing the action. Then, step S912 is executed.
[0100] In step S910-2, a horizontal distance (i.e., the first landing horizontal distance) is set for the action to be performed for crossing the obstacle according to the default configuration. Setting the horizontal distance here means performing the target action described above to climb or traverse the obstacle according to the default configured horizontal distance. Then, step S912 is executed.
[0101] In step S912, after the horizontal ray detection, a ray is then fired vertically downward from the air to perform a height ray detection. Based on the height detection result, in step S914, it is determined whether the obstacle plane has been hit. If the obstacle plane has been hit, the height of the obstacle plane is obtained in step S916. Then, step S918 is executed to perform a traversal or climb based on the current height and horizontal distance.
[0102] It should be noted that the premise for executing the above step S912 is to follow the instructions of the current virtual scene. In this example, it is necessary to complete the collision detection of the horizontal distance and the vertical height detection at the same time, and after obtaining the horizontal landing distance to be referenced for executing the target action based on the collision distance, the collision position is used as the contact position, and vertical ray detection is performed based on this to obtain the control height to be referenced for executing the target action.
[0103] above Figure 9 The process shown is an example, and this embodiment does not limit the example description and process therein.
[0104] It should be noted that for the aforementioned method embodiments, for simplicity of description, they are all expressed as a series of action combinations. However, those skilled in the art should be aware that the present invention is not limited by the order of the actions described, because according to the present invention, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in this specification are all preferred embodiments, and the actions and modules involved are not necessarily required by the present invention.
[0105] According to another aspect of the embodiment of the present invention, an object control device for implementing the above object control method is also provided. Figure 10 As shown, the device includes:
[0106] A display unit 1002 is configured to display a virtual scene in a display interface, wherein the virtual scene includes a target virtual object and a target virtual obstacle;
[0107] a determining unit 1004, configured to determine, in response to an operation performed on an action button displayed in the display interface, a first landing horizontal distance configured for a target action to be performed by the target virtual object;
[0108] The control unit 1006 is used to control the target virtual object to perform the target action according to the second landing horizontal distance to pass through the target virtual obstacle when the first landing horizontal distance does not meet the landing condition matching the target virtual obstacle, wherein the second landing horizontal distance meets the landing condition.
[0109] Optionally, in this embodiment, the embodiments to be implemented by the above-mentioned various unit modules can refer to the above-mentioned various method embodiments, which will not be repeated here.
[0110] According to another aspect of the embodiment of the present invention, an electronic device for implementing the above object control method is also provided. The electronic device may be Figure 1 The terminal device or server shown in FIG. This embodiment is described by taking the electronic device as a terminal device as an example. Figure 11 As shown, the electronic device includes a memory 1102 and a processor 1104. The memory 1102 stores a computer program, and the processor 1104 is configured to execute the steps in any of the above method embodiments through the computer program.
[0111] Optionally, in this embodiment, the electronic device may be located in at least one network device among a plurality of network devices of a computer network.
[0112] Optionally, in this embodiment, the processor may be configured to execute the following steps through a computer program:
[0113] S1, displaying a virtual scene on a display interface, wherein the virtual scene includes a target virtual object and a target virtual obstacle;
[0114] S2, in response to an operation performed on an action button displayed in the display interface, determining a first landing horizontal distance configured for a target action to be performed by the target virtual object;
[0115] S3, when the first landing horizontal distance does not meet the landing condition matching the target virtual obstacle, controlling the target virtual object to perform the target action according to the second landing horizontal distance to pass through the target virtual obstacle, wherein the second landing horizontal distance meets the landing condition.
[0116] Alternatively, those skilled in the art will appreciate that Figure 11 The structure shown is for illustration only, and the electronic device may also be a smart phone (such as an Android phone, an iOS phone, etc.), a tablet computer, a PDA, a mobile Internet device (MID), a PAD, or other terminal devices. Figure 11 It does not limit the structure of the electronic device. For example, the electronic device may also include Figure 11 More or fewer components (such as network interfaces, etc.) as shown in, or with Figure 11 Different configurations shown.
[0117] Among them, the memory 1102 can be used to store software programs and modules, such as program instructions / modules corresponding to the object control method and device in the embodiment of the present invention. The processor 1104 executes various functional applications and data processing by running the software programs and modules stored in the memory 1102, that is, realizing the above-mentioned object control method. The memory 1102 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 1102 may further include a memory remotely located relative to the processor 1104, and these remote memories may be connected to the terminal via a network. Examples of the above-mentioned networks include but are not limited to the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof. Among them, the memory 1102 can be used to store, but is not limited to, information such as attribute information of the target virtual object and attribute information of the target virtual obstacle. As an example, if Figure 11 As shown, the memory 1102 may include, but is not limited to, the display unit 1002, the determination unit 1004, and the control unit 1006 in the object control device. In addition, it may also include, but is not limited to, other module units in the object control device, which will not be repeated in this example.
[0118] Optionally, the transmission device 1106 is configured to receive or send data via a network. Specific examples of the network may include a wired network and a wireless network. In one embodiment, the transmission device 1106 includes a network interface controller (NIC), which can be connected to other network devices and a router via a network cable to communicate with the Internet or a local area network. In one embodiment, the transmission device 1106 is a radio frequency (RF) module, which is configured to communicate with the Internet wirelessly.
[0119] In addition, the above-mentioned electronic device also includes: a display 1108, which is used to display the above-mentioned virtual scene, wherein the virtual scene includes a target virtual object and a target virtual obstacle, and is also used to display the scene picture during the object control process; and a connection bus 1110, which is used to connect the various module components in the above-mentioned electronic device.
[0120] In other embodiments, the terminal device or server may be a node in a distributed system, wherein the distributed system may be a blockchain system, and the blockchain system may be a distributed system formed by connecting multiple nodes through network communication. The nodes may form a peer-to-peer (P2P) network, and any computing device, such as a server, terminal, or other electronic device, may become a node in the blockchain system by joining the peer-to-peer network.
[0121] According to one aspect of the present application, a computer program product is provided, comprising a computer program / instructions containing program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network via a communication component and / or installed from a removable medium. When the computer program is executed by a central processing unit, the various functions provided in the embodiments of the present application are performed.
[0122] The serial numbers of the above embodiments of the present invention are for description only and do not represent the advantages or disadvantages of the embodiments.
[0123] According to one aspect of the present application, a computer-readable storage medium is provided. A processor of a 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 object control method provided above.
[0124] Optionally, in this embodiment, the computer-readable storage medium may be configured to store a computer program for performing the following steps:
[0125] S1, displaying a virtual scene on a display interface, wherein the virtual scene includes a target virtual object and a target virtual obstacle;
[0126] S2, in response to an operation performed on an action button displayed in the display interface, determining a first landing horizontal distance configured for a target action to be performed by the target virtual object;
[0127] S3, when the first landing horizontal distance does not meet the landing condition matching the target virtual obstacle, controlling the target virtual object to perform the target action according to the second landing horizontal distance to pass through the target virtual obstacle, wherein the second landing horizontal distance meets the landing condition.
[0128] Optionally, in this embodiment, a person of ordinary skill in the art may understand that all or part of the steps in the various methods of the above embodiments may be completed by instructing the hardware related to the terminal device through a program, and the program may be stored in a computer-readable storage medium, which may include: a flash drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc.
[0129] If the integrated units in the above embodiments are implemented in the form of software functional units and sold or used as independent products, they can be stored in the above-mentioned computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the existing technology, or all or part of the technical solution can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes a number of instructions for causing one or more computer devices (such as personal computers, servers, or network devices) to execute all or part of the steps of the methods described in various embodiments of the present invention.
[0130] In the above embodiments of the present invention, the description of each embodiment has its own focus. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0131] In the several embodiments provided in this application, it should be understood that the disclosed client can be implemented in other ways. Among them, the device embodiments described above are merely illustrative. For example, the division of the units is merely a logical function division. In actual implementation, there may be other division methods, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of units or modules, and can be electrical or other forms.
[0132] The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of these units may be selected to achieve the purpose of this embodiment according to actual needs.
[0133] In addition, the functional units in the various embodiments of the present invention may be integrated into a single processing unit, each unit may exist physically separately, or two or more units may be integrated into a single unit. The aforementioned integrated units may be implemented in the form of hardware or software functional units.
[0134] The above is only a preferred embodiment of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present invention. These improvements and modifications should also be regarded as within the scope of protection of the present invention.
Claims
1. An object control method, characterized in that: include: Displaying a virtual scene in a display interface, wherein the virtual scene includes a target virtual object, a target virtual obstacle, and a reference obstacle, the target virtual object is located on one side of the target virtual obstacle, and the reference obstacle is adjacent to the target virtual obstacle on the other side; In response to an operation performed on an action button displayed in the display interface, determining a first landing horizontal distance configured for a target action to be performed by the target virtual object, wherein the target action includes a climbing action or a climbing action; When the first landing horizontal distance is greater than the distance between the target virtual object and the reference obstacle, the target virtual object is controlled to perform the target action according to the second landing horizontal distance to pass through the target virtual obstacle, wherein the second landing horizontal distance is less than the distance between the target virtual object and the reference obstacle and greater than the distance between the target virtual object and the target virtual obstacle.
2. The method according to claim 1, characterized in that When determining the first landing horizontal distance configured for the target action to be performed by the target virtual object, the method further includes: Obtaining a reference landing interval required for the target virtual object to pass through the target virtual obstacle; When the first landing horizontal distance is not within the reference landing interval, it is determined that the first landing horizontal distance does not meet the landing condition matching the target virtual obstacle. When the first landing horizontal distance does not meet the landing condition, the target virtual object is controlled to perform the target action according to the second landing horizontal distance to pass through the target virtual obstacle.
3. The method according to claim 2, characterized in that The step of obtaining a reference landing interval required for the target virtual object to pass through the target virtual obstacle includes: Constructing a first ray for obstacle detection with the target virtual object as a starting point and the direction of the target virtual object as an extension direction; performing collision detection on the target virtual obstacle using the first ray to obtain a collision detection result; When the collision detection result indicates that a reference obstacle is also included in the extension direction of the first ray, obtaining a collision distance from the target virtual object to the reference obstacle; The distance interval indicated by the collision distance is determined as the reference landing interval.
4. The method according to claim 3, characterized in that After performing collision detection on the target virtual obstacle using the first ray and obtaining a collision detection result, the method further includes: When the collision detection result indicates that the reference obstacle is not included in the extension direction of the first ray, but the first landing horizontal distance is greater than the width of the target virtual obstacle, the distance interval indicated by the width of the target virtual obstacle is determined as the reference landing interval.
5. The method according to claim 3, characterized in that The performing collision detection on the target virtual obstacle by using the first ray to obtain a collision detection result includes: Determining a detection distance according to the first landing horizontal distance; Perform collision detection on the target virtual obstacle according to the detection distance.
6. The method according to claim 1, characterized in that When controlling the target virtual object to perform the target action according to the second landing horizontal distance, the method further includes: determining a contact position between the target virtual object and the target virtual obstacle; Obtaining a height of the target virtual obstacle at the contact position; The target virtual object is controlled to perform the target action according to the height.
7. The method according to claim 6, characterized in that The acquiring of the height of the target virtual obstacle at the contact position includes: Constructing a second ray for height detection in a vertical direction; Using the second ray to perform height detection on the contact position of the target virtual obstacle to obtain a height detection result; The height corresponding to the contact position is obtained from the height detection result.
8. The method according to any one of claims 1 to 7, characterized in that Before controlling the target virtual object to perform the target action according to the second landing horizontal distance, the method further includes: In response to an operation performed on a climbing action button displayed in the display interface, determining that the target action to be performed by the target virtual object is a climbing action; or In response to an operation performed on a flipping action button displayed in the display interface, it is determined that the target action to be performed by the target virtual object is a flipping action.
9. An object control device, characterized in that: include: a display unit, configured to display a virtual scene in a display interface, wherein the virtual scene includes a target virtual object, a target virtual obstacle, and a reference obstacle, wherein the target virtual object is located on one side of the target virtual obstacle, and the reference obstacle is adjacent to the target virtual obstacle on the other side; a determining unit, configured to determine, in response to an operation performed on an action button displayed in the display interface, a first landing horizontal distance configured for a target action to be performed by the target virtual object, wherein the target action includes a climbing action or a climbing action; a control unit, configured to control the target virtual object to perform the target action according to a second landing horizontal distance to pass through the target virtual obstacle when the first landing horizontal distance is greater than the distance between the target virtual object and the reference obstacle, wherein the second landing horizontal distance is less than the distance between the target virtual object and the reference obstacle and greater than the distance between the target virtual object and the target virtual obstacle.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium includes a stored program, wherein the method according to any one of claims 1 to 8 is executed when the program is executed.
11. A computer program product comprising a computer program / instructions, characterized in that When the computer program / instructions are executed by a processor, the steps of the method according to any one of claims 1 to 8 are implemented.
12. An electronic device comprising a memory and a processor, characterized in that: A computer program is stored in the memory, and the processor is configured to execute the method according to any one of claims 1 to 8 through the computer program.
Citation Information
Patent Citations
Object jumping control method, object jumping control device, computer equipment and storage medium
CN110193198A
Vedio game device and information storage medium for vedio game
CN1254893A