Method, device, electronic device and storage medium for determining position in virtual scene

By determining the coordinates of the click position and the starting point of the virtual character in the virtual scene, combined with the preset position and route generation, the problem of the virtual character being unable to accurately reach the operating position is solved, achieving higher arrival accuracy and operating efficiency.

CN114253401BActive Publication Date: 2024-10-25ZHENGZHOU J&T HI TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202111615390.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-12-27
Publication Date
2024-10-25
Estimated Expiration
2041-12-27

AI Technical Summary

Technical Problem

In the existing technology, the virtual character cannot accurately reach the position of the operation target object in the virtual scene. As a result, when the click position is inaccurate, multiple clicks are required to move to the actual operation position.

Method used

Provide a graphical user interface through the terminal device, respond to click operations, determine the coordinate position of the click position in the complete virtual scene and the current starting point of the virtual character, determine the actual arrival position based on the target object position closest to the preset position from the coordinate position, and generate a route to control the virtual character to move to the location, avoid obstacles and rotate to reach accurately.

Benefits of technology

It improves the accuracy of the virtual character's arrival position, reduces the number of clicks, and ensures that the virtual character can effectively operate the target object.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114253401B_ABST
    Figure CN114253401B_ABST
Patent Text Reader

Abstract

The present application provides a method, device, electronic device and storage medium for determining a position in a virtual scene, wherein the method comprises: responding to a click operation on a click position in a portion of the virtual scene, determining the coordinate position of the click position in the complete virtual scene and the first starting position of the virtual character in the portion of the virtual scene; determining the actual arrival position according to the position of the target object closest to the coordinate position in at least one preset position in the complete virtual scene. The embodiment of the present application can improve the accuracy of the determined arrival position through the above method.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of human-computer interaction technology, and in particular to a method, device, electronic device and storage medium for determining a position in a virtual scene. Background Art

[0002] With the development and popularization of terminal devices, more and more virtual scenes are being used in teaching, demonstration, games and other scenarios. By operating virtual characters in the virtual scenes, specified actions, including movement, are completed.

[0003] The inventors discovered during their research that, in the prior art, the click position is usually directly used as the arrival position of the virtual character. This means that when one wants to control the virtual character to reach the operation position for operating the target object, if the click position is inaccurate, multiple clicks are required to move to the actual operation position. That is, when the click position is inaccurate, the actual arrival position of the virtual character cannot be determined. Summary of the invention

[0004] In view of this, embodiments of the present application provide a method, device, electronic device, and storage medium for determining a position in a virtual scene to improve the accuracy of the determined arrival position.

[0005] In a first aspect, an embodiment of the present application provides a method for determining a position in a virtual scene, wherein a terminal device provides a graphical user interface, and the graphical user interface displays a portion of a virtual scene and a virtual character, and the method includes:

[0006] In response to a click operation on a click position in the partial virtual scene, determining a coordinate position of the click position in the complete virtual scene and a first starting point position of the virtual character in the partial virtual scene; wherein the complete virtual scene includes the partial virtual scene;

[0007] The actual arrival position is determined according to the target object position closest to the coordinate position in at least one preset position in the complete virtual scene; wherein the actual arrival position is the position where the virtual character can operate the target object.

[0008] In a feasible implementation manner, determining the actual arrival position according to the position of the target object closest to the coordinate position in at least one position preset in the complete virtual scene includes:

[0009] Determining at least one preset position in the complete virtual scene;

[0010] Calculating a position of the at least one position that is closest to the coordinate position, so as to use the position as the target object position;

[0011] The target object position is taken as the second starting position, the direction of movement from the coordinate position to the second starting position in the direction pointed by the second starting position is taken as the second direction, and the position in the second direction that is the target length away from the second starting position is taken as the actual arrival position.

[0012] In a feasible implementation manner, after determining the actual arrival position, the method further includes:

[0013] generating a first route based on the first starting point location and the target object location;

[0014] generating a second route based on the target object location and the actual arrival location;

[0015] Based on the first route and the second route, the virtual character is controlled to move from the first starting position to the actual arrival position.

[0016] In a feasible implementation manner, generating a first route based on the coordinate position and the target object position includes:

[0017] Determine the obstacle position of each obstacle in the complete virtual scene moving from the first starting point position to the target object position;

[0018] Based on the obstacle position, determining at least one moving obstacle avoidance route from the first starting point position to the target object position;

[0019] The route that meets the preset requirements among the at least one moving obstacle avoidance route is determined as the first route; wherein the route that meets the preset requirements includes: a route with the shortest moving distance and a route with the shortest moving time.

[0020] In a feasible implementation manner, before controlling the virtual character to move from the first starting position to the actual arrival position based on the first route and the second route, the method further includes:

[0021] The direction currently facing the virtual character is taken as a first direction, the direction of the first route pointing to the target object position at the first starting point is taken as a second direction, and the virtual character is controlled to rotate from the first direction to the second direction at a preset speed.

[0022] In a feasible implementation manner, taking a position that is a target length away from the second starting position in the second direction as the actual arrival position includes:

[0023] Determine a sub-route in the first route with the target object position as the end point coordinate;

[0024] Calculate a first vector between the starting point coordinates of the sub-route and the end point coordinates;

[0025] Calculate a unit vector having the same direction as the first vector;

[0026] Calculating the product of the unit vector and the target length to use the product as a second vector;

[0027] The position obtained by moving the second vector from the position of the target object is used as the actual arrival position.

[0028] In a second aspect, an embodiment of the present application further provides a device for determining a position in a virtual scene, wherein a graphical user interface is provided through a terminal device, and a portion of a virtual scene and a virtual character are displayed on the graphical user interface, and the device comprises:

[0029] a response unit, configured to respond to a click operation on a click position in the partial virtual scene, and determine a coordinate position of the click position in the complete virtual scene and a first starting point position of the virtual character in the partial virtual scene; wherein the complete virtual scene includes the partial virtual scene;

[0030] A determination unit is used to determine an actual arrival position according to a target object position closest to the coordinate position in at least one position preset in the complete virtual scene; wherein the actual arrival position is a position where the virtual character can operate the target object.

[0031] In a feasible implementation manner, the determining unit is used to:

[0032] Determining at least one preset position in the complete virtual scene;

[0033] Calculating a position of the at least one position that is closest to the coordinate position, so as to use the position as the target object position;

[0034] The target object position is taken as the second starting position, the direction of movement from the coordinate position to the second starting position in the direction pointed by the second starting position is taken as the second direction, and the position in the second direction that is the target length away from the second starting position is taken as the actual arrival position.

[0035] In a feasible embodiment, the device further comprises:

[0036] A first generating unit, configured to generate a first route based on the first starting point position and the target object position after determining the actual arrival position;

[0037] A second generating unit, configured to generate a second route based on the target object position and the actual arrival position;

[0038] A moving unit is used to control the virtual character to move from the first starting position to the actual arrival position based on the first route and the second route.

[0039] In a feasible implementation manner, the first generating unit is used to:

[0040] Determine the obstacle position of each obstacle in the complete virtual scene moving from the first starting point position to the target object position;

[0041] Based on the obstacle position, determining at least one moving obstacle avoidance route from the first starting point position to the target object position;

[0042] The route that meets the preset requirements among the at least one moving obstacle avoidance route is determined as the first route; wherein the route that meets the preset requirements includes: a route with the shortest moving distance and a route with the shortest moving time.

[0043] In a feasible embodiment, the device further comprises:

[0044] A steering unit is used to control the virtual character to move from the first starting position to the actual arrival position based on the first route and the second route, taking the direction currently facing the virtual character as the first direction, taking the direction of the first route pointing to the target object position at the first starting position as the second direction, and controlling the virtual character to rotate from the first direction to the second direction at a preset speed.

[0045] In a feasible implementation manner, the determining unit is used to:

[0046] Determine a sub-route in the first route with the target object position as the end point coordinate;

[0047] Calculate a first vector between the starting point coordinates of the sub-route and the end point coordinates;

[0048] Calculate a unit vector having the same direction as the first vector;

[0049] Calculating the product of the unit vector and the target length to use the product as a second vector;

[0050] The position obtained by moving the second vector from the position of the target object is used as the actual arrival position.

[0051] In a third aspect, an embodiment of the present application further provides an electronic device, comprising: a processor, a storage medium and a bus, wherein the storage medium stores machine-readable instructions executable by the processor, and when the electronic device is running, the processor communicates with the storage medium through the bus, and the processor executes the machine-readable instructions to perform the steps of the method as described in any one of the first aspects.

[0052] In a fourth aspect, an embodiment of the present application further provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the steps of the method described in any one of the first aspects are executed.

[0053] The embodiment of the present application provides a method, device, electronic device and storage medium for determining a position in a virtual scene, wherein a graphical user interface is provided through a terminal device, and a portion of a virtual scene and a virtual character are displayed on the graphical user interface, wherein the method comprises: responding to a click operation on a click position in the portion of the virtual scene, determining the coordinate position of the click position in the complete virtual scene and the first starting position of the virtual character in the portion of the virtual scene; wherein the complete virtual scene includes the portion of the virtual scene; determining the actual arrival position according to the position of the target object closest to the coordinate position in at least one position preset in the complete virtual scene; wherein the actual arrival position is the position where the virtual character can operate the target object. Through the above method, the graphical user interface can determine the actual arrival position according to the coordinate position of the click position in the virtual scene, which can improve the accuracy of the determined arrival position compared with the prior art of directly taking the coordinate position corresponding to the click position as the arrival position.

[0054] In order to make the above-mentioned objects, features and advantages of the present application more obvious and easy to understand, preferred embodiments are specifically cited below and described in detail with reference to the attached drawings. BRIEF DESCRIPTION OF THE DRAWINGS

[0055] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments will be briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present application and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.

[0056] Figure 1 A flow chart of a method for determining a position in a virtual scene provided in an embodiment of the present application is shown.

[0057] Figure 2 A flow chart of a method for determining an actual arrival position provided in an embodiment of the present application is shown.

[0058] Figure 3 A schematic diagram of the structure of a device for determining a position in a virtual scene provided in an embodiment of the present application is shown.

[0059] Figure 4 A schematic structural diagram of an electronic device provided in an embodiment of the present application is shown.

[0060] Figure 5 A schematic diagram of a partial virtual scene provided in an embodiment of the present application is shown.

[0061] Figure 6 A schematic diagram of determining an actual arrival position provided in an embodiment of the present application is shown. DETAILED DESCRIPTION

[0062] To make the purpose, technical scheme and advantages of the embodiments of the present application clearer, the technical scheme in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. It should be understood that the drawings in the present application only serve the purpose of explanation and description and are not used to limit the scope of protection of the present application. In addition, it should be understood that the schematic drawings are not drawn in real proportion. The flowchart used in this application shows the operations implemented according to some embodiments of the present application. It should be understood that the operations of the flowchart can be implemented out of sequence, and the steps without logical context can be reversed in order or implemented simultaneously. In addition, those skilled in the art can add one or more other operations to the flowchart under the guidance of the content of the present application, or remove one or more operations from the flowchart.

[0063] In addition, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. The components of the embodiments of the present application described and shown in the drawings here can be arranged and designed in various configurations. Therefore, the following detailed description of the embodiments of the present application provided in the drawings is not intended to limit the scope of the application claimed for protection, but merely represents the selected embodiments of the present application. Based on the embodiments of the present application, all other embodiments obtained by those skilled in the art without making creative work belong to the scope of protection of the present application.

[0064] It should be noted in advance that the term "comprising" will be used in the embodiments of the present application to indicate the existence of the features declared thereafter, but does not exclude the addition of other features.

[0065] It should be noted in advance that the devices or electronic devices involved in the embodiments of the present application can be executed on a single server or on a server group. The server group can be centralized or distributed. In some embodiments, the server can be local or remote relative to the terminal. For example, the server can access information and / or data stored in a service requester terminal, a service provider terminal, or a database, or any combination thereof via a network. As another example, the server can be directly connected to at least one of the service requester terminal, the service provider terminal, and the database to access the stored information and / or data. In some embodiments, the server can be implemented on a cloud platform; as an example only, the cloud platform can include a private cloud, a public cloud, a hybrid cloud, a community cloud, a distributed cloud, an inter-cloud, a multi-cloud, etc., or any combination thereof.

[0066] In addition, the device or electronic device involved in the embodiment of the present application can be executed on an access device or a third-party device, and specifically can include: a mobile device, a tablet computer, a laptop computer, or a built-in device in a motor vehicle, or any combination thereof. In some embodiments, the mobile device may include a smart home device, a wearable device, a smart mobile device, a virtual reality device, or an augmented reality device, or any combination thereof. In some embodiments, the smart home device may include a control device for a smart electrical appliance, a smart monitoring device, a smart TV, a smart camera, or an intercom, or any combination thereof. In some embodiments, the wearable device may include a smart bracelet, a smart helmet, a smart watch, a smart accessory, or any combination thereof. In some embodiments, the smart mobile device may include a smart phone, a personal digital assistant (PDA), a gaming device, a navigation device, or any combination thereof. In some embodiments, the virtual reality device and / or the augmented reality device may include a virtual reality helmet, an augmented reality helmet, or any combination thereof. For example, the virtual reality device and / or the augmented reality device may include various virtual reality products, etc.

[0067] Figure 1 A flowchart of a method for determining a position in a virtual scene provided by an embodiment of the present application is shown, wherein a graphical user interface is provided by a terminal device, and a portion of a virtual scene and a virtual character are displayed on the graphical user interface, such as Figure 1 As shown, the method is specifically implemented by the following steps:

[0068] Step 101, in response to a click operation on a click position in the partial virtual scene, determine the coordinate position of the click position in the complete virtual scene and the first starting position of the virtual character in the partial virtual scene; wherein the complete virtual scene includes the partial virtual scene.

[0069] Specifically, the complete virtual scene includes at least one virtual character, at least one target object to be operated, and a graphical user interface for displaying part of the virtual scene in the complete virtual scene to the user through a terminal device; the terminal device can be any display terminal, such as a computer, a display screen, a mobile phone, etc. When the terminal device monitors that the graphical user interface triggers a click operation, the click position of the click operation in the graphical user interface is determined. The click operation can be triggered by a mouse clicking on the graphical user interface provided by the terminal device. When the terminal device providing the graphical user interface supports a touch screen, the click operation is triggered by a user clicking on the graphical user interface provided by the terminal device, and the position that triggers the click operation is the click position. According to the position of the click position in the partial virtual scene, the coordinate position of the click position in the complete virtual scene is determined; the first starting point position is the coordinate point of the virtual character in the partial virtual scene in response to the click operation.

[0070] Step 102, determining an actual arrival position according to a target object position closest to the coordinate position in at least one position preset in the complete virtual scene; wherein the actual arrival position is a position where the virtual character can operate the target object.

[0071] Specifically, the target object is a virtual object in a complete virtual scene, which can represent equipment, devices, devices, items, special places, etc. in the virtual scene; the target object position is a preset coordinate point for each target object; with the coordinate position as the center point, the target object position closest to the coordinate position in the virtual scene is calculated, and the target object corresponding to the target object position closest to the coordinate position is determined as the actual operation object of the virtual character, and the actual arrival position of the virtual character is determined according to the target object position. Among them, the target object position is not the position where the virtual character can actually operate the target object. In the actual movement process of the virtual character, if the target object position is used as the end point, due to the error of the radius of the virtual character's own collision capsule, when the collision capsule outside the virtual character collides with the target object position, the virtual character does not actually reach the position. In this case, it is necessary to determine the actual arrival position of the virtual character according to the target object position, that is, the actual arrival position is the position where the virtual character can actually operate / reach the target object.

[0072] The embodiment of the present application provides a method for determining a position in a virtual scene, which provides a graphical user interface through a terminal device, and the graphical user interface displays a partial virtual scene and a virtual character, and the method includes: responding to a click operation on a click position in the partial virtual scene, determining the coordinate position of the click position in the complete virtual scene and the first starting point position of the virtual character in the partial virtual scene; wherein the complete virtual scene includes the partial virtual scene; determining the actual arrival position according to the position of the target object closest to the coordinate position in at least one position preset in the complete virtual scene; wherein the actual arrival position is the position where the virtual character can operate the target object. Through the above method, the graphical user interface can determine the actual arrival position according to the coordinate position of the click position in the virtual scene, which can improve the accuracy of the determined arrival position compared with the prior art that directly uses the coordinate position corresponding to the click position as the arrival position.

[0073] In one possible embodiment, Figure 2 A flow chart of a method for determining an actual arrival position provided by an embodiment of the present application is shown. Figure 2 As shown, when executing step 102, according to the position of the target object closest to the coordinate position in at least one position preset in the complete virtual scene, the method includes the following steps:

[0074] Step 201: determine at least one preset position in the complete virtual scene.

[0075] Specifically, multiple positions are preset in the complete virtual scene, and each position corresponds to a target object; in the embodiment of the present application, in order to reduce the amount of calculation, only at least one preset position within a preset distance range near the coordinate position can be determined.

[0076] Step 202: Calculate the position of the at least one position that is closest to the coordinate position, and use the position as the target object position.

[0077] Specifically, taking the point where the coordinate position is located as the center of the circle, the straight-line distance between each position in the at least one position and the coordinate position is calculated, and the position with the smallest straight-line distance is taken as the target value object position.

[0078] For example, Figure 5A schematic diagram of a partial virtual scene provided by an embodiment of the present application is shown, as shown in the figure, including: a graphical user interface 501, a virtual character 502, a coordinate position 503 of a click position in a complete virtual scene, a preset first position 504, and a preset second position 505. Wherein, the graphical user interface 501 provides a partial virtual scene, and the coordinate position 503, the preset first position 504, and the preset second position 505 are respectively three-dimensional coordinate points in the partial virtual scene. With the coordinate position 503 as the center of the circle, the calculation of the partial virtual scene is as follows: Figure 5 The position of the marked first position 504 and the marked second position 505 that is closest to the coordinate position 503 in three dimensions, assuming that the position closest to the coordinate position 503 in three dimensions is the first position 504, then the first position 504 is determined as the target object position; if the position closest to the coordinate position 503 in three dimensions is the second position 505, then the first position 505 is determined as the target object position. 515 is the position of the preset second position 505 projected onto the ground, 514 is the position of the preset first position 504 projected onto the ground, and 513 is the position of the coordinate position 503 projected onto the ground.

[0079] Step 203, taking the target object position as the second starting position, taking the direction of movement from the coordinate position to the second starting position in the direction pointed by the second starting position as the second direction, and taking the position in the second direction that is a target length away from the second starting position as the actual arrival position.

[0080] Specifically, the target length can be preset or calculated according to the target formula. For example, the target length can be the radius of the virtual character's collision capsule. The embodiment of the present application does not limit the method for setting the target length. After determining the second direction, at the position of the second starting point, the position point obtained by moving the target length along the second direction is the actual arrival position.

[0081] In a feasible implementation manner, after determining the actual arrival position according to step 203, the method further includes the following steps:

[0082] Step 211, generating a first route based on the first starting point position and the target object position; generating a second route based on the target object position and the actual arrival position; and controlling the virtual character to move from the first starting point position to the actual arrival position based on the first route and the second route.

[0083] Specifically, the route between the first starting point position and the target object position is taken as the first route, and the route between the second starting point position (target object position) and the actual arrival position is taken as the second route. The virtual character is controlled to move according to the first route and the second route so that the virtual character reaches the actual arrival position from the first starting point position.

[0084] For example, Figure 6 A schematic diagram of determining an actual arrival position provided by an embodiment of the present application is shown. Figure 5 When the three-dimensional image in the image is projected into a two-dimensional image (looking down), assuming that the current target object position is 514 and the position of the virtual character is 602 (i.e., the first starting position), the first route 605 between the first starting position 602 and the target object position 514, and the second route 604 between the target object position 514 and the actual arrival position 603, where 602 is Figure 5 The virtual character 502 is projected onto the ground, and 601 is a two-dimensional top-view image of a part of the virtual scene projected onto the ground.

[0085] It should be noted that after the virtual character reaches the actual arrival position, the optimal operating area preset for the target device is determined. When the area currently facing the target character is not in the optimal operating area, the target character is controlled to rotate to the optimal operating area every frame.

[0086] In a feasible implementation manner, when executing step 211 to generate a first route based on the first starting point location and the target object location, the method further includes the following steps:

[0087] Step 212: determine the obstacle position of each obstacle moving from the first starting point position to the target object position in the complete virtual scene.

[0088] Specifically, in a complete virtual scene, including at least one obstacle, when there is no obstacle between the first starting point position and the target object position, the first route is a line segment between the first starting point position and the target object position; when there is an obstacle in the route between the first starting point position and the target position, the virtual character cannot directly reach the target object position along the route, and it is necessary to obtain the obstacle position of each obstacle from the first starting point position to the target object position, wherein the movement from the first starting point position to the target object position can be in a straight line or in a curve.

[0089] Step 213: Based on the obstacle position, determine at least one obstacle avoidance route from the first starting point position to the target object position.

[0090] Specifically, after the obstacle position of each obstacle is determined according to step 212, at least one moving obstacle avoidance route is determined based on the obstacle position of each obstacle, so that the virtual character can avoid each obstacle and move from the first starting point position to the target object position.

[0091] Step 214, determining the route that meets the preset requirements among the at least one moving obstacle avoidance route as the first route; wherein the route that meets the preset requirements includes: a route with the shortest moving distance and a route with the shortest moving time.

[0092] Specifically, in the embodiment of the present application, there is no restriction on the setting method of the preset requirements. According to the preset requirements, the route with the shortest moving distance from the first starting position to the target object position / the route with the shortest moving time from the first starting position to the target object position can be determined from at least one mobile obstacle avoidance route, so that the virtual character can quickly reach the target object position.

[0093] In a feasible implementation manner, before executing step 211 to control the virtual character to move from the first starting position to the actual arrival position based on the first route and the second route, the method further includes the following steps:

[0094] The direction currently facing the virtual character is taken as a first direction, the direction of the first route pointing to the target object position at the first starting point is taken as a second direction, and the virtual character is controlled to rotate from the first direction to the second direction at a preset speed.

[0095] Specifically, after determining the first route, determine the direction the virtual character is currently facing, and when the direction the virtual character is currently facing is different from the direction of the first route pointing to the target object position at the first starting point, control the virtual character to rotate from the first direction to the second direction. The embodiment of the present application does not limit the method for setting the preset speed.

[0096] In a feasible implementation, in step 203, taking the position in the second direction that is a target length away from the second starting position as the actual arrival position includes the following steps:

[0097] Determine a sub-route in the first route with the target object position as the end point coordinates; calculate a first vector between the start point coordinates of the sub-route and the end point coordinates; calculate a unit vector with the same direction as the first vector; calculate the product of the unit vector and the target length, and use the product as a second vector; and use a position obtained by moving the second vector from the target object position as the actual arrival position.

[0098] Specifically, the sub-route with the target object position as the end point coordinates is the last sub-route in the first route that contains the target object position. In an embodiment of the present application, a sub-route is a route formed when a virtual character performs the minimum movement. When the virtual character in the complete virtual scene moves according to a grid, each sub-route is a distance of one grid, and the sub-route with the target object position as the end point coordinates is the route of the last moving grid in the first route. Assuming that the starting point coordinates of the above sub-route are A and the end point coordinates are B, the first vector AB is the coordinates of point B minus the coordinates of point A; the calculation formula for the unit vector a is:

[0099]

[0100] Among them, AB is the first vector, and |AB| is the modulus of the first vector, that is, the magnitude of the first vector.

[0101] After obtaining the unit vector a, the calculation formula for the second vector b is:

[0102] b = a × r;

[0103] Where r is the target length, the calculation formula for the actual arrival position c is:

[0104] c = b + B;

[0105] Figure 3 The structure of a device for determining a position in a virtual scene provided by an embodiment of the present application is shown. A graphical user interface is provided by a terminal device, and a part of a virtual scene and a virtual character are displayed on the graphical user interface, such as Figure 3 As shown, the device includes a responding unit 301 and a determining unit 302.

[0106] The response unit 301 is used to respond to a click operation on a click position in the partial virtual scene, determine the coordinate position of the click position in the complete virtual scene and the first starting position of the virtual character in the partial virtual scene; wherein the complete virtual scene includes the partial virtual scene.

[0107] The determination unit 302 is used to determine the actual arrival position according to the target object position closest to the coordinate position in at least one position preset in the complete virtual scene; wherein the actual arrival position is the position where the virtual character can operate the target object.

[0108] In a feasible implementation manner, the determining unit is used to:

[0109] At least one preset position in the complete virtual scene is determined.

[0110] A position among the at least one position that is closest to the coordinate position is calculated to use the position as the target object position.

[0111] The target object position is taken as the second starting position, the direction of movement from the coordinate position to the second starting position in the direction pointed by the second starting position is taken as the second direction, and the position in the second direction that is the target length away from the second starting position is taken as the actual arrival position.

[0112] In a feasible embodiment, the device further comprises:

[0113] The first generating unit is configured to generate a first route based on the first starting point position and the target object position after determining the actual arrival position.

[0114] The second generating unit is used to generate a second route based on the target object position and the actual arrival position.

[0115] A moving unit is used to control the virtual character to move from the first starting position to the actual arrival position based on the first route and the second route.

[0116] In a feasible implementation manner, the first generating unit is used to:

[0117] Determine the obstacle position of each obstacle in the complete virtual scene moving from the first starting point position to the target object position.

[0118] Based on the obstacle position, at least one moving obstacle avoidance route is determined from the first starting point position to the target object position.

[0119] The route that meets the preset requirements among the at least one moving obstacle avoidance route is determined as the first route; wherein the route that meets the preset requirements includes: a route with the shortest moving distance and a route with the shortest moving time.

[0120] In a feasible embodiment, the device further comprises:

[0121] A steering unit is used to control the virtual character to move from the first starting position to the actual arrival position based on the first route and the second route, taking the direction currently facing the virtual character as the first direction, taking the direction of the first route pointing to the target object position at the first starting position as the second direction, and controlling the virtual character to rotate from the first direction to the second direction at a preset speed.

[0122] In a feasible implementation manner, the determining unit is used to:

[0123] A sub-route in the first route with the target object position as the end point coordinates is determined.

[0124] A first vector between the starting point coordinates of the sub-route and the end point coordinates is calculated.

[0125] Calculate a unit vector that has the same direction as the first vector.

[0126] A product of the unit vector and the target length is calculated to use the product as a second vector.

[0127] The position obtained by moving the second vector from the position of the target object is used as the actual arrival position.

[0128] Figure 4 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application is shown, including: a processor 401, a storage medium 402 and a bus 403, wherein the storage medium 402 stores machine-readable instructions executable by the processor 401, and when the electronic device runs the method for determining a position in a virtual scene as in the embodiment, the processor 401 communicates with the storage medium 402 via the bus 403, and the processor 401 executes the machine-readable instructions to perform the steps in the embodiment.

[0129] In an embodiment, the storage medium 402 may also execute other machine-readable instructions to execute other methods described in the embodiment. For specific execution method steps and principles, please refer to the description of the embodiment, which will not be described in detail here.

[0130] The embodiments of the present application further provide a computer-readable storage medium, on which a computer program is stored. The computer program is executed when a processor is running to perform the steps in the embodiments.

[0131] In the embodiment of the present application, the computer program can also execute other machine-readable instructions when run by the processor to execute other methods described in the embodiment. For the specific execution method steps and principles, please refer to the description of the embodiment, which will not be repeated here.

[0132] In the several embodiments provided in the present application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. The device embodiments described above are merely schematic. For example, the division of the modules is only a logical function division. There may be other division methods in actual implementation. For example, multiple modules or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some communication interfaces, and the indirect coupling or communication connection of devices or modules can be electrical, mechanical or other forms.

[0133] The modules described as separate components may or may not be physically separated, and the components shown as modules may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0134] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.

[0135] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a non-volatile computer-readable storage medium that is executable by a processor. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for a computer device (which can be a personal computer, server, or network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as USB flash drives, mobile hard drives, ROM, RAM, magnetic disks, or optical disks.

[0136] The above are only specific implementations of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.

Claims

1. A method for determining a position in a virtual scene, characterized in that: Providing a graphical user interface through a terminal device, wherein a portion of a virtual scene and a virtual character are displayed on the graphical user interface, the method comprising: In response to a click operation on a click position in the partial virtual scene, determining a coordinate position of the click position in the complete virtual scene and a first starting point position of the virtual character in the partial virtual scene; wherein the complete virtual scene includes the partial virtual scene; Determine the actual arrival position according to the target object position closest to the coordinate position in at least one position preset in the complete virtual scene; wherein the actual arrival position is the position where the virtual character can operate the target object; Determining the actual arrival position according to the position of the target object closest to the coordinate position in at least one position preset in the complete virtual scene includes: Determining at least one preset position in the complete virtual scene; Calculating a position of the at least one position that is closest to the coordinate position, so as to use the position as the target object position; The target object position is taken as the second starting position, the direction of movement from the coordinate position to the second starting position in the direction pointed by the second starting position is taken as the second direction, and the position in the second direction that is the target length away from the second starting position is taken as the actual arrival position.

2. The method according to claim 1, characterized in that After determining the actual arrival position, the method further includes: generating a first route based on the first starting point location and the target object location; generating a second route based on the target object location and the actual arrival location; Based on the first route and the second route, the virtual character is controlled to move from the first starting position to the actual arrival position.

3. The method according to claim 2, characterized in that Based on the coordinate position and the target object position, generating a first route includes: Determine the obstacle position of each obstacle in the complete virtual scene moving from the first starting point position to the target object position; Based on the obstacle position, determining at least one moving obstacle avoidance route from the first starting point position to the target object position; The route that meets the preset requirements among the at least one moving obstacle avoidance route is determined as the first route; wherein the route that meets the preset requirements includes: a route with the shortest moving distance and a route with the shortest moving time.

4. The method according to claim 2, characterized in that: Before controlling the virtual character to move from the first starting position to the actual arrival position based on the first route and the second route, the method further includes: The direction currently facing the virtual character is taken as a first direction, the direction of the first route pointing to the target object position at the first starting point is taken as a second direction, and the virtual character is controlled to rotate from the first direction to the second direction at a preset speed.

5. The method according to claim 2, characterized in that: Taking a position that is a target length away from the second starting position in the second direction as the actual arrival position, comprising: Determine a sub-route in the first route with the target object position as the end point coordinate; Calculate a first vector between the starting point coordinates of the sub-route and the end point coordinates; Calculate a unit vector having the same direction as the first vector; Calculating the product of the unit vector and the target length to use the product as a second vector; The position obtained by moving the second vector from the position of the target object is used as the actual arrival position.

6. A device for determining a position in a virtual scene, characterized in that: A graphical user interface is provided through a terminal device, and part of a virtual scene and a virtual character are displayed on the graphical user interface. The device includes: a response unit, configured to respond to a click operation on a click position in the partial virtual scene, and determine a coordinate position of the click position in the complete virtual scene and a first starting point position of the virtual character in the partial virtual scene; wherein the complete virtual scene includes the partial virtual scene; A determination unit, configured to determine an actual arrival position according to a target object position closest to the coordinate position in at least one position preset in the complete virtual scene; wherein the actual arrival position is a position where the virtual character can operate the target object; The determining unit is used for: Determining at least one preset position in the complete virtual scene; Calculating a position of the at least one position that is closest to the coordinate position, so as to use the position as the target object position; The target object position is taken as the second starting position, the direction of movement from the coordinate position to the second starting position in the direction pointed by the second starting position is taken as the second direction, and the position in the second direction that is the target length away from the second starting position is taken as the actual arrival position.

7. An electronic device, characterized in that: include: A processor, a storage medium and a bus, wherein the storage medium stores machine-readable instructions executable by the processor, and when the electronic device is running, the processor and the storage medium communicate via the bus, and the processor executes the machine-readable instructions to perform the steps of the method for determining a position in a virtual scene as described in any one of claims 1 to 5.

8. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the method for determining a position in a virtual scene as claimed in any one of claims 1 to 5 are executed.