Method, apparatus, and electronic device for determining object position
By searching information for preset positions in the virtual scene and automatically searching for adjustment positions outside the obstacle area, the problem of high computing resources and manual operation requirements for object position determination in the prior art is solved, and efficient object position determination and smooth game operation are achieved.
Patent Information
- Application Number
- CN202210902567.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-07-29
- Publication Date
- 2025-07-18
- Estimated Expiration
- 2042-07-29
AI Technical Summary
When determining the location of an object in a virtual scene, the prior art requires a large amount of manual operation and computing resources, resulting in a stuttering game operation, especially when there are many obstacles or large ranges, it is difficult to efficiently determine the location of an object.
By presetting the location search information of the virtual scene, including the attribute information of the scene location, automatically searching for adjustment positions outside the obstacle area, using the attribute information to determine the final position of the target object, and reducing the needs of manual operations and computing resources.
It realizes efficient determination of object locations in virtual scenes, reduces manual workload and computing resource usage, and ensures smooth operation of the game.
Smart Images

Figure CN115430146B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of games, and in particular, to a method, device, and electronic device for determining the position of an object. Background Art
[0002] In a virtual scene, there are usually obstacles, such as mountains, walls, etc.; it is necessary to prevent an object that appears in the virtual scene from passing through these obstacles; when the number of objects is large, it is difficult to manually select the position where the object appears in the virtual scene. In the related art, a position range can be preset in advance, and this position range does not contain obstacles. By controlling the position where the object appears to be within this position range, it is possible to prevent the object from passing through the obstacles; however, when the virtual scene range is large or there are many obstacles, when setting the position range that does not contain obstacles, the workload is large and the operation is cumbersome. In another way, first select the position where the object appears in the virtual scene, and then determine whether this position passes through an obstacle. If it passes through an obstacle, re-select a position in the virtual scene until a position that does not pass through an obstacle is found; when there are many obstacles in the virtual scene, it may be necessary to select and judge multiple times to find a position that does not pass through an obstacle, and this process occupies a large amount of computing resources, resulting in game lag. Summary of the Invention
[0003] In view of this, an object of the present invention is to provide a method, device, and electronic device for determining the position of an object, which on the one hand reduces the manual workload, and on the other hand reduces the computing resources occupied when determining the position of the object, ensuring the smooth operation of the game.
[0004] In a first aspect, an embodiment of the present invention provides a method for determining the position of an object, the method including: determining an initial position of a target object from a virtual scene; wherein, there are obstacles in the virtual scene; the obstacles are located in an obstacle area in the virtual scene; the virtual scene is preset with position search information; the position search information includes: attribute information of each scene position in the virtual scene; the attribute information is used to provide a search method for an adjustment position corresponding to the scene position; the adjustment position is located outside the obstacle area in the virtual scene; the adjustment position is obtained by automatically searching at least part of the scene positions in the virtual scene; searching for the attribute information of the initial position from the position search information, and based on the attribute information of the initial position, determining the final position of the target object in the virtual scene.
[0005] For a non-obstacle position outside the obstacle area in the virtual scene, the attribute information of the non-obstacle position includes a first indication identifier; the first indication identifier is used to: indicate that the non-obstacle position is outside the obstacle area; for an obstacle position within the obstacle area, the attribute information of the obstacle position includes: relative position information between the obstacle position and the adjustment position corresponding to the obstacle position.
[0006] The above-mentioned location search information is generated in the following manner: Determine the obstacle area in the virtual scene; for non-obstacle positions outside the obstacle area, set the attribute information of the non-obstacle positions as the first indication identifier; for obstacle positions within the obstacle area, search for non-obstacle positions with the first indication identifier through a preset search method, and use the found non-obstacle positions as the adjusted positions of the obstacle positions; generate the attribute information of the obstacle positions based on the adjusted positions; and use the attribute information of each scene position in the virtual scene as the location search information.
[0007] The above-mentioned step of determining the obstacle area in the virtual scene includes: obtaining the initial area occupied by the obstacles in the virtual scene; and performing an expansion process on the initial area to obtain the obstacle area.
[0008] The above-mentioned step of, for an obstacle position within the obstacle area, searching for a non-obstacle position with the first indication identifier through a preset search method and using the found non-obstacle position as the adjusted position of the obstacle position includes: obtaining a non-obstacle position from the virtual scene and using the obtained non-obstacle position as the reference position; for the first obstacle position in the position row and position column where the reference position is located, using the reference position as the adjusted position of the first obstacle position; for the second obstacle position outside the position row and position column, searching for the first nearby positions within the first specified range from the second obstacle position, and determining the adjusted position of the second obstacle position based on the attribute information of the non-obstacle positions and / or obstacle positions among the first nearby positions.
[0009] The above-mentioned step of, for the second obstacle position outside the position row and position column, searching for the first nearby positions within the specified range from the second obstacle position and determining the adjusted position of the second obstacle position based on the attribute information of the non-obstacle positions and / or obstacle positions among the first nearby positions includes: for the second obstacle position outside the position row and position column, for each of the first nearby positions within the first specified range from the second obstacle position, successively perform the following operations: determine whether the first nearby position belongs to a non-obstacle position or an obstacle position; if the first nearby position belongs to a non-obstacle position, determine the adjusted position of the second obstacle position based on the attribute information of the first nearby position; if the first nearby position belongs to an obstacle position and the first nearby position is set with attribute information, determine the adjusted position of the second obstacle position based on the attribute information of the first nearby position.
[0010] The first nearby positions within the above-mentioned first specified range satisfy the following conditions: with the second obstacle position as the reference, the first nearby position has a specified relative direction to the second obstacle position, and the first nearby position has a specified first relative distance from the second obstacle position; wherein, the relative direction includes one or more of: leftward, rightward, upward, downward, upper leftward, lower leftward, upper rightward, and lower rightward.
[0011] If the first nearby position belongs to a non-obstacle position, the step of determining the adjustment position of the second obstacle position according to the attribute information of the first nearby position includes: if the first nearby position belongs to a non-obstacle position and the second obstacle position does not currently have attribute information set, determining the first nearby position as the adjustment position of the second obstacle position; if the first nearby position belongs to a non-obstacle position and the second obstacle position currently has attribute information set, obtaining a first distance between the position indicated by the attribute information of the second obstacle position and the second obstacle position, and a second distance between the first nearby position and the second obstacle position; based on the magnitude relationship between the first distance and the second distance, determining the adjustment position of the second obstacle position.
[0012] If the first nearby position belongs to an obstacle position and the first nearby position has attribute information set, the step of determining the adjustment position of the second obstacle position according to the attribute information of the first nearby position includes: if the first nearby position belongs to an obstacle position and the first nearby position has attribute information set, and the second obstacle position does not currently have attribute information set, obtaining the position indicated by the attribute information of the first nearby position and determining the obtained position as the adjustment position of the second obstacle position; if the first nearby position belongs to an obstacle position and the first nearby position has attribute information set, and the second obstacle position currently has attribute information set, obtaining a third distance between the position indicated by the attribute information of the first nearby position and the second obstacle position, and a fourth distance between the position indicated by the attribute information of the second obstacle position and the second obstacle position; based on the magnitude relationship between the third distance and the fourth distance, determining the adjustment position of the second obstacle position.
[0013] After the step of, for a second obstacle position other than the position row and the position column, finding nearby positions within a specified range from the second obstacle position and determining the adjustment position of the second obstacle position according to the attribute information of the non-obstacle positions and / or obstacle positions among the nearby positions, the method further includes: taking each obstacle position in the virtual scene as the current position one by one and obtaining second nearby positions within a second specified range of the current position; for each second nearby position, performing the following operations: if the second nearby position is a non-obstacle position, obtaining a fifth distance between the second nearby position and the current position, and a sixth distance between the position indicated by the attribute information of the current position and the current position; based on the magnitude relationship between the fifth distance and the sixth distance, setting the attribute information of the current position; if the second nearby position is an obstacle position, obtaining a seventh distance between the position indicated by the attribute information of the second nearby position and the current position, and an eighth distance between the position indicated by the attribute information of the current position and the current position; based on the magnitude relationship between the seventh distance and the eighth distance, setting the attribute information of the current position.
[0014] The second nearby positions within the second specified range satisfy the following condition: with the current position as the reference, the second nearby position has a specified second relative distance from the current position.
[0015] The above step of generating the attribute information of the obstacle position based on the adjusted position includes: generating position offset information based on the adjusted position and the obstacle position, and using the position offset information as the attribute information of the obstacle position; wherein, the position offset information is used to: after performing a position offset according to the position offset information with the obstacle position as a reference, obtain the adjusted position.
[0016] The above step of determining the final position of the target object in the virtual scene based on the attribute information of the initial position includes: if the attribute information of the initial position includes a first indication identifier, determining the initial position as the adjusted position of the initial position, and using the adjusted position as the final position of the target object in the virtual scene; wherein, the first indication identifier is used to: indicate that the initial position is outside the obstacle area; if the attribute information of the initial position includes the relative position information of the adjusted position corresponding to the initial position, obtaining the adjusted position based on the relative position information, and using the adjusted position as the final position of the target object in the virtual scene.
[0017] In a second aspect, an embodiment of the present invention provides an apparatus for determining an object position. The apparatus includes: a first determination module, configured to determine an initial position of a target object from a virtual scene; wherein, there are obstacles in the virtual scene; the obstacles are located in an obstacle area in the virtual scene; the virtual scene is preset with position search information; the position search information includes: attribute information of each scene position in the virtual scene; the attribute information is used to provide a search method for obtaining an adjusted position corresponding to the scene position; the adjusted position is located outside the obstacle area in the virtual scene; the adjusted position is obtained by automatically searching at least part of the scene positions in the virtual scene; a second determination module, configured to search for the attribute information of the initial position from the position search information, and determine the final position of the target object in the virtual scene based on the attribute information of the initial position.
[0018] In a third aspect, an embodiment of the present invention provides an electronic device, including a processor and a memory. The memory stores machine-executable instructions that can be executed by the processor, and the processor executes the machine-executable instructions to implement the above object position determination method.
[0019] In a fourth aspect, an embodiment of the present invention provides a machine-readable storage medium, which stores machine-executable instructions. When the machine-executable instructions are called and executed by a processor, the machine-executable instructions cause the processor to implement the above object position determination method.
[0020] The embodiments of the present invention bring the following beneficial effects:
[0021] The above method, apparatus, and electronic device for determining an object's position determine the initial position of a target object from a virtual scene; wherein, there are obstacles in the virtual scene; the obstacles are located in an obstacle area in the virtual scene; the virtual scene is preset with position search information; the position search information includes: attribute information of each scene position in the virtual scene; the attribute information is used to provide a search method for the adjustment position corresponding to the scene position; the adjustment position is located outside the obstacle area in the virtual scene; the adjustment position is obtained by automatically searching at least part of the scene positions in the virtual scene; search for the attribute information of the initial position from the position search information, and based on the attribute information of the initial position, determine the final position of the target object in the virtual scene. In this method, the adjustment position corresponding to the scene position is obtained in advance through an automatic search method, and then the position search information of the virtual scene is obtained, without a large amount of manual operations; when determining the object's position, accessing the position search information once can obtain the object's position, and it can be ensured that the object's position is outside the obstacle area. On the one hand, this method can reduce the manual workload, and the acquisition method of the position search information is simple and convenient. On the other hand, it can reduce the computing resources occupied when determining the object's position and ensure the smooth operation of the game.
[0022] Other features and advantages of the present invention will be described in the following specification, and, in part, will be obvious from the specification, or will be understood by implementing the present invention. The objectives and other advantages of the present invention are achieved and obtained by the structures specifically pointed out in the specification, claims, and drawings.
[0023] To make the above objectives, features, and advantages of the present invention more obvious and understandable, the following specifically provides preferred embodiments and, in conjunction with the accompanying drawings, makes a detailed description as follows. BRIEF DESCRIPTION OF THE DRAWINGS
[0024] To more clearly illustrate the specific embodiments of the present invention or the technical solutions in the prior art, the following will briefly introduce the drawings required for use in the description of the specific embodiments or the prior art. Obviously, the following drawings are some embodiments of the present invention. For those skilled in the art, without creative efforts, other drawings can also be obtained based on these drawings.
[0025] Figure 1 It is a flowchart of a method for determining an object's position provided by an embodiment of the present invention;
[0026] Figure 2 It is a schematic diagram of an obstacle area provided by an embodiment of the present invention;
[0027] Figure 3 It is a schematic diagram of the relative direction in a first specified range provided by an embodiment of the present invention;
[0028] Figure 4Schematic diagram of the second specified range provided by the embodiments of the present invention;
[0029] Figure 5 Schematic structural diagram of a device for determining the position of an object provided by the embodiments of the present invention;
[0030] Figure 6 Schematic diagram of an electronic device provided by the embodiments of the present invention. Detailed implementation manners
[0031] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings. Apparently, the described embodiments are some, but not all, of the embodiments of the present invention. All other embodiments obtained by those skilled in the art based on the embodiments of the present invention without creative efforts shall fall within the protection scope of the present invention.
[0032] In a virtual scene, various objects such as falling objects and NPCs (Non-Player Characters) often need to appear. Taking the falling object as an example, according to the scene requirements or game requirements, it is necessary to randomly generate falling objects in the virtual scene, such as health packs. The position of the falling object needs to be outside the obstacle so that it can be seen and used by the player. When the demand for falling objects is large, it is difficult to manually set the position of each falling object in the virtual scene.
[0033] In the related art, usually a block is set in the virtual scene, and the block is used to prevent virtual objects from passing through obstacles; after adding the block, the virtual objects can only move around the obstacles. For falling objects, the position of the falling object needs to be set outside the block.
[0034] In one way, a coordinate system is set in the virtual scene. Based on this coordinate system, the coordinate range that does not contain obstacles is determined, and a coordinate point is randomly selected within this coordinate range to obtain the position of the object outside the block. This method requires manually specifying the coordinate range to ensure that the randomly obtained coordinate points are not within the block. However, once a large number of coordinate points are required, the workload of specifying a suitable coordinate range becomes very large.
[0035] In another way, a coordinate system is set in the virtual scene. Based on the coordinate system, a coordinate point is randomly selected in the virtual scene, and then it is determined whether the coordinate point is outside the obstruction. If the coordinate point is outside the obstruction, the coordinate point can be used as the location of the dropped object; if the coordinate point is inside the obstruction, it is necessary to reselect the coordinate point in the virtual scene and continue to determine whether the coordinate point is outside the obstruction until a coordinate point outside the obstruction is found. However, if the obstruction range of the virtual scene is large, it is necessary to repeatedly select the coordinate point. If a large number of coordinate points need to be selected, multiple selection and judgment steps need to be performed for each coordinate point, which will increase the logic of the game operation, occupy a large amount of computing resources, and cause the game to freeze.
[0036] Based on the above, an embodiment of the present invention provides a method, device and electronic device for determining the position of an object. This technology can be applied to determine the position from any virtual scene, and is used to determine the position of various models such as dropped objects, virtual objects, NPCs, etc.
[0037] To facilitate understanding of this embodiment, a method for determining the position of an object disclosed in an embodiment of the present invention is first introduced in detail. Figure 1 As shown, the method comprises the following steps:
[0038] Step S102, determining the initial position of the target object from the virtual scene; wherein there is an obstacle in the virtual scene; the obstacle is located in the obstacle area of the virtual scene; the virtual scene is preset with position search information; the position search information includes: attribute information of each scene position in the virtual scene; the attribute information is used to provide a search method for an adjustment position corresponding to the scene position; the adjustment position is located outside the obstacle area of the virtual scene; the adjustment position is obtained by automatically searching at least part of the scene positions in the virtual scene;
[0039] The virtual scene can be a game scene or a virtual scene for other purposes. In the virtual scene, an immovable obstacle model is usually provided, such as a mountain model, a wall model, a stone pillar model, etc. For movable objects in the virtual scene, it is necessary to avoid the object passing through the obstacle model or even being located inside the obstacle model. Based on this purpose, the present embodiment needs to determine the position of the target object in the virtual scene or a certain scene range of the virtual scene.
[0040] The above-mentioned obstacles usually occupy a certain area range in the virtual scene. The above-mentioned obstacle area can be determined as the area range occupied by the obstacle, or can be slightly larger than the area range of the obstacle. The purpose of this embodiment is to make the determined position of the target object located outside the obstacle area with less computational effort. Based on this, before executing step S102, it is necessary to preset the position search information of the virtual scene. In this position search information, it can include the attribute information of each scene position in the virtual scene, or only include the attribute information of the scene positions within the obstacle area.
[0041] The attribute information of the scene position is used to provide the search method for the adjusted position corresponding to the scene position; in a specific implementation manner, for the scene positions outside the obstacle area, they can be directly used as the positions of the target object in the virtual scene. At this time, for the scene positions outside the obstacle area, the attribute information can directly indicate that the scene position is a scene position outside the obstacle area; for the positions within the obstacle area, these positions cannot be used as the positions of the target object in the virtual scene. At this time, for the scene positions within the obstacle area, the attribute information can provide a scene position outside the obstacle area corresponding to this scene position, that is, the adjusted position corresponding to the scene position; usually, this adjusted position is near the scene position, or can also have a certain distance. The attribute information of the scene positions within the obstacle area can directly record the position coordinates of the adjusted position, or record the path information from the scene position to the adjusted position, so that the adjusted position can be obtained based on the attribute information.
[0042] For the scene positions within the obstacle area, the positions around the scene position can be searched to obtain the position closer to this scene position as the adjusted position of this scene position; or, for the scene positions within the obstacle area, each position in the virtual scene can be traversed to obtain the position with the closest distance to this scene position as the adjusted position of this scene position. In actual implementation, the search range or search conditions can be preset, and the computer automatically searches for the adjusted position corresponding to the scene position.
[0043] In actual implementation, the initial position of the target object can be randomly determined from the virtual scene, or can be randomly determined within a specified area in the virtual scene, or the initial position of the target object can be determined in a certain order. Usually, when determining the initial position, it is not considered whether this initial position is outside the obstacle area. A coordinate system can be set in the virtual scene, and all kinds of positions involved in this embodiment can be represented by position coordinates.
[0044] Step S104, search for the attribute information of the initial position from the above-mentioned position search information, and determine the final position of the target object in the virtual scene based on the attribute information of the initial position.
[0045] For example, if the attribute information indicates that the initial position is outside the obstacle area, the initial position can be directly used as the final position of the target object in the virtual scene; if the attribute information indicates the position coordinates or path information for finding the adjusted position, the adjusted position is obtained based on the attribute information, and this adjusted position is used as the final position of the target object in the virtual scene.
[0046] In a specific application scenario, there are falling objects that need to appear randomly in the virtual scene. Since the number of falling objects is usually large, in this case, with the falling objects as the target objects, through the above method, an initial position is randomly obtained from the virtual scene first, and then the final position of the target object is determined according to the position search information, so as to ensure that the falling objects do not pass through obstacles.
[0047] It should be noted that the obstacle area in the virtual scene and the area outside the obstacle area can be determined through the blocking file of the virtual scene. The blocking file includes: the range within which virtual objects can move in the virtual scene. Through this blocking file, it can be determined whether each scene position in the virtual scene is outside the obstacle area or within the obstacle area.
[0048] When setting the position search information in this embodiment, the adjusted position of the scene position can be automatically searched by a computer, so as to obtain the attribute information of the scene position, without manual information setting. At the same time, when determining the object position, only one access to the position search information is required to obtain the position of the target object, without multiple searches and judgments.
[0049] The above method for determining the object position determines the initial position of the target object from the virtual scene; wherein, there are obstacles in the virtual scene; the obstacles are located in the obstacle area of the virtual scene; the virtual scene is preset with position search information; the position search information includes: the attribute information of each scene position in the virtual scene; the attribute information is used to provide the search method for the adjusted position corresponding to the scene position; the adjusted position is located outside the obstacle area of the virtual scene; the adjusted position is obtained by automatically searching at least part of the scene positions in the virtual scene; the attribute information of the initial position is searched from the position search information, and based on the attribute information of the initial position, the final position of the target object in the virtual scene is determined. In this method, the adjusted position corresponding to the scene position is obtained in advance through automatic search, and then the position search information of the virtual scene is obtained, without a large amount of manual operations; when determining the object position, accessing the position search information once can obtain the object position, and it can be ensured that the object position is outside the obstacle area. On the one hand, this method can reduce the manual workload, and the acquisition method of the position search information is simple and convenient. On the other hand, it can reduce the computing resources occupied when determining the object position and ensure the smooth operation of the game.
[0050] The following embodiments continue to describe the specific content of the location search information.
[0051] In the location search information, it may include the attribute information of each scene location in the virtual scene. For non-obstacle locations outside the obstacle area in the virtual scene, the attribute information of the non-obstacle location includes a first indication identifier; the first indication identifier is used to: indicate that the non-obstacle location is outside the obstacle area; for obstacle locations within the obstacle area, the attribute information of the obstacle location includes: the relative position information between the obstacle location and the adjusted position corresponding to the obstacle location.
[0052] In actual implementation, the location search information can be implemented using a two-dimensional array. Each scene location in the virtual scene corresponds to an element in the two-dimensional array. For example, if the width of the virtual scene is w and the height is h, then the width of the two-dimensional array is w and the height is h. The attribute information of the corresponding scene is stored in this element, and the attribute information of the scene location can be represented by a vector of length three, such as (a, b, c) as an example, and the attribute information can be (1, 0, 0), (0, 2, 1); where the first digit a indicates whether the scene location is outside the obstacle area or within the obstacle area; for example, a = 1 indicates that the scene location is outside the obstacle area, that is, the scene location is a non-obstacle location; a = 0 indicates that the scene location is within the obstacle area, that is, the scene location is an obstacle location. In this example, the first indication identifier is (1, 0, 0).
[0053] In the initial state, for scene locations outside the obstacle area, the set attribute information is (1, 0, 0), that is, the first indication identifier; for scene locations within the obstacle area, the initial information of the attribute information can be set to (0, 0, 0). When the attribute information of the scene location is (0, 0, 0), it can be understood that the attribute information of this scene location has not been set yet.
[0054] The second and third digits in the attribute information represent the relative position information between the obstacle location and the adjusted position corresponding to the obstacle location; for example, the coordinates of the obstacle location are (x1, y1), and the adjusted position corresponding to this obstacle location is (x2, y2); at this time, the second digit b = x2 - x1; the third digit c = y2 - y1. At this time, the attribute information is (0, x2 - x1, y2 - y1).
[0055] For scene locations outside the obstacle area, the attribute information is all (1, 0, 0); where b = 0 and c = 0; indicating that the adjusted position of this scene location is the scene location itself.
[0056] The following embodiments describe the generation method of the location search information.
[0057] The location search information is generated in the following manner: Determine the obstacle areas in the virtual scene; for the non-obstacle positions outside the obstacle areas, set the attribute information of the non-obstacle positions as the first indication identifier; for the obstacle positions inside the obstacle areas, search for non-obstacle positions with the first indication identifier through a preset search method, and use the found non-obstacle positions as the adjusted positions of the obstacle positions; generate the attribute information of the obstacle positions based on the adjusted positions; and use the attribute information of each scene position in the virtual scene as the location search information.
[0058] When there are multiple obstacles in the virtual scene, the obstacle areas can be processed for each obstacle or each group of consecutive obstacles. Considering that the model of the target object usually occupies a certain area, if the position of the target object is at the edge of the obstacle, the model of the target object may pass through the obstacle. Therefore, it is necessary to avoid the position of the target object being too close to the obstacle. Based on this, obtain the initial area occupied by the obstacles in the virtual scene; perform an expansion process on the initial area to obtain the obstacle areas.
[0059] Specifically, based on the initial area occupied by the obstacles, expand the distance of multiple position points outward to obtain the obstacle areas. In actual implementation, an expansion operation in image processing can be used to process the initial area. In one way, a blocking map of the virtual scene can be obtained, which contains the edge line information of the obstacles, that is, the edge lines of the initial area. Performing a convolution operation on this blocking map can achieve the expansion operation of the initial area.
[0060] Figure 2 As an example, the edge contour of the virtual scene is the largest rectangle, where the initial area is the smallest rectangle. After the initial area is processed by the expansion operation, the obstacle area is obtained, and the area of the obstacle area is larger than the area of the initial area.
[0061] For the non-obstacle positions outside the obstacle areas, since there is no need to search for adjusted positions, the non-obstacle positions are directly set as the first indication identifier, and the first indication identifiers of different non-obstacle positions are the same or partially the same.
[0062] For the obstacle positions inside the obstacle areas, it is necessary to find the non-obstacle positions corresponding to the obstacle positions as the adjusted positions of the obstacle positions; if multiple non-obstacle positions are found, one position can be selected from the multiple non-obstacle positions based on a preset rule as the adjusted position. The preset search method can be random search or search in a certain position order. For example, with the obstacle position as the reference, search one by one around the obstacle position, or search along a certain direction.
[0063] After obtaining the attribute information of each scene position, the position search information can be saved in the form of a file to obtain a position search file.
[0064] When finding the adjusted position of an obstacle position, in a specific implementation, a non-obstacle position is obtained from the virtual scene, and the obtained non-obstacle position is used as the reference position; for the first obstacle position in the position row and position column where the reference position is located, the reference position is used as the adjusted position of the first obstacle position; for the second obstacle position outside the position row and position column, the first nearby position within the first specified range from the second obstacle position is searched, and the adjusted position of the second obstacle position is determined according to the attribute information of the non-obstacle position and / or the obstacle position in the first nearby position.
[0065] A non-obstacle position can be obtained from the virtual scene in a random manner by obtaining any non-obstacle position in the virtual scene, or a non-obstacle position can be obtained by sequential search.
[0066] In this embodiment, first, attribute information is set for each scene position in a position row and a position column of the virtual scene. After obtaining a non-obstacle position, the non-obstacle position is used as the reference position, and each scene position in the position row and position column to which the non-obstacle position belongs is traversed. If an obstacle position, that is, the above-mentioned first obstacle position, is traversed, the reference position is used as the adjusted position of the first obstacle position; based on the adjusted position, the attribute information of the first obstacle position can be obtained. At this time, the non-obstacle positions and obstacle positions on a position row and a position column in the virtual scene are set with attribute information.
[0067] Furthermore, for the second obstacle position outside the position row and position column, for each second obstacle position, non-obstacle positions are searched within the first specified range of the second obstacle position; if there is a non-obstacle position within the first specified range, the non-obstacle position can be used as the adjusted position of the second obstacle position; if there are multiple non-obstacle positions within the first specified range, the non-obstacle position closest to the second obstacle position can be used as the adjusted position of the second obstacle position; if there are only obstacle positions within the first specified range, the adjusted position of the second obstacle position is determined according to the position indicated by the attribute information of the obstacle position; if there are multiple obstacle positions with attribute information within the first specified range, the position closest to the second obstacle position among the positions indicated by these attribute information is used as the adjusted position of the second obstacle position. If there are both non-obstacle positions and obstacle positions within the first specified range, the position closest to the second obstacle position among the multiple positions that can be used as the adjusted position is used as the adjusted position of the second obstacle position.
[0068] In a specific implementation manner, for a second obstacle position other than the position row and the position column, for each first nearby position within a first specified range from the second obstacle position, the following operations are sequentially performed: determining whether the first nearby position belongs to a non-obstacle position or an obstacle position; if the first nearby position belongs to a non-obstacle position, determining an adjustment position of the second obstacle position according to the attribute information of the first nearby position; if the first nearby position belongs to an obstacle position and the first nearby position is set with attribute information, determining an adjustment position of the second obstacle position according to the attribute information of the first nearby position.
[0069] The first nearby positions within the above-mentioned first specified range satisfy the following conditions: with the second obstacle position as a reference, the first nearby position has a specified relative direction with respect to the second obstacle position, and the first nearby position has a specified first relative distance from the second obstacle position; wherein, the relative directions include one or more of: leftward, rightward, upward, downward, upper leftward, lower leftward, upper rightward, and lower rightward.
[0070] In an example, as Figure 3 shown, each grid represents a scene position, and the position shown in bold in the middle is the second obstacle position. Figure 3 Eight relative directions are shown, that is, leftward, rightward, upward, downward, upper leftward, lower leftward, upper rightward, and lower rightward; each line represents a direction, and the first relative distance is 3 positions; in this example, the first specified range includes a total of 24 first nearby positions.
[0071] The relative direction can be represented by direction coordinates as (xOffset, yOffset). For example, the direction coordinate of the leftward direction is (-1,0), and the direction coordinate of the upper leftward direction is represented as (-1, +1); the coordinates in the relative direction can be represented as (Xn,Yn)=(x1,y1)+(xOffset, yOffset)*n; where, (x1,y1) is the coordinate of the second obstacle position; n represents the distance, that is, in a certain direction, the distance between two positions (Xn,Yn) and (x1,y1).
[0072] It should be noted that the scene positions within the first specified range need to be within the virtual scene. When the second obstacle position is at the edge of the virtual scene, if according to the above conditions, the positions obtained within the first specified range may include positions outside the virtual scene, the positions outside the virtual scene can be directly skipped and the above-mentioned processing is not performed.
[0073] Since there are multiple first nearby positions within the first specified range of the second obstacle position, therefore, during the process of traversing the positions within the first specified range, the adjustment position of the second obstacle position may change, and the attribute information will also be set multiple times.
[0074] Specifically, for each first nearby position within the first specified range, if the first nearby position belongs to a non-obstacle position and the second obstacle position does not currently have attribute information set, the first nearby position is determined as the adjusted position of the second obstacle position; if the first nearby position belongs to a non-obstacle position and the second obstacle position currently has attribute information set, obtain the first distance between the position indicated by the attribute information of the second obstacle position and the second obstacle position, and the second distance between the first nearby position and the second obstacle position; based on the magnitude relationship between the first distance and the second distance, determine the adjusted position of the second obstacle position.
[0075] For example, the coordinates of the second obstacle position are (1, 1), and the coordinates of the first nearby position are (2, 3); and the second obstacle position does not have attribute information set. At this time, the first nearby position is determined as the adjusted position of the second obstacle position, and the attribute information of the second obstacle position can be set to (0, (2 - 1), (3 - 1)), that is, (0, 1, 2).
[0076] For another example, the coordinates of the second obstacle position are (1, 1), the attribute information of the second obstacle position is (0, 2, 3), and the coordinates of the first nearby position are (5, 6). At this time, the first distance is the square root of (2 2 + 3 2 ), that is, the square root of 13; the second distance is the square root of ((5 - 1) 2 +(6 - 1) 2 ), that is, the square root of 41; at this time, the first distance is less than the second distance, and the adjusted position of the second obstacle position is still the adjusted position corresponding to the current attribute information of the second obstacle position;
[0077] For another example, the coordinates of the second obstacle position are (1, 1), the attribute information of the second obstacle position is (0, 4, 7), and the coordinates of the first nearby position are (5, 6). At this time, the first distance is the square root of (4 2 + 7 2 ), that is, the square root of 65; the second distance is the square root of ((5 - 1) 2 +(6 - 1) 2 ), that is, the square root of 41; at this time, the first distance is greater than the second distance, and the adjusted position of the second obstacle position is set to the first nearby position. At this time, the attribute information of the second obstacle position is set to (0, 4, 5).
[0078] Further, if the first nearby position belongs to an obstacle position, and the first nearby position is set with attribute information, and the second obstacle position does not currently have attribute information set, obtain the position indicated by the attribute information of the first nearby position, and determine the obtained position as the adjusted position of the second obstacle position; if the first nearby position belongs to an obstacle position, and the first nearby position is set with attribute information, and the second obstacle position currently has attribute information set, obtain the third distance between the position indicated by the attribute information of the first nearby position and the second obstacle position, and the fourth distance between the position indicated by the attribute information of the second obstacle position and the second obstacle position; based on the magnitude relationship between the third distance and the fourth distance, determine the adjusted position of the second obstacle position.
[0079] For example, the coordinates of the first nearby position are (1, 1), the attribute information of the first nearby position is (0, 3, 4), and the second obstacle position does not have attribute information set. At this time, obtain the position coordinates indicated by the attribute information of the first nearby position, (3 + 1, 4 + 1), that is, (4, 5); use this position as the adjusted position of the second obstacle position, the coordinates of the second obstacle position are (2, 3), and at this time, the attribute information of the second obstacle position is (0, (4 - 2), (5 - 3)), that is, (0, 2, 2).
[0080] Again, for example, the coordinates of the first nearby position are (1, 1), the attribute information of the first nearby position is (0, 3, 4). At this time, the position indicated by the attribute information of the first nearby position is (4, 5); the coordinates of the second obstacle position are (2, 3), and the attribute information of the second obstacle position is (0, 7, 8). At this time, the position indicated by the attribute information of the second obstacle position is (9, 11); the third distance is the square root of ((4 - 2) 2 +(5 - 3) 2 ), that is, the square root of 8; the fourth distance is the square root of (7 2 +8 2 ), that is, the square root of 113; the third distance is less than the fourth distance. At this time, the adjusted position of the second obstacle position is determined to be the position indicated by the attribute information of the first nearby position, that is, (4, 5), and the attribute information of the second obstacle position is set to (0, 2, 2).
[0081] Again, for example, the coordinates of the first nearby position are (1, 1), the attribute information of the first nearby position is (0, 3, 4). At this time, the position indicated by the attribute information of the first nearby position is (4, 5); the coordinates of the second obstacle position are (2, 3), and the attribute information of the second obstacle position is (0, 1, 1). At this time, the position indicated by the attribute information of the second obstacle position is (3, 4); the third distance is the square root of ((4 - 2) 2 +(5 - 3) 2 ), that is, the square root of 8; the fourth distance is the square root of (1 2 +1 2) The square root of, that is, the square root of 2; the third distance is greater than the fourth distance. At this time, the adjusted position of the second obstacle position remains unchanged, and the attribute information of the second obstacle position remains unchanged.
[0082] Through the above method, the position search information includes the attribute information of each scene position in the virtual scene. Based on this position search information, when determining the object position, for the initial position outside the obstacle area, the initial position can be directly used as the final position of the target object; for the initial position inside the obstacle area, the attribute information of the initial position can be obtained from the position search information, and the adjusted position can be found based on this attribute information, and the adjusted position is used as the final position of the target object.
[0083] Considering that in the above method, when obtaining the adjusted position of each obstacle position, only a part of the scene positions around the obstacle position are traversed. The problem that may occur is that for some obstacle positions, the adjusted position corresponding to their attribute information may be far from the obstacle position. In order to further make the adjusted position closer to the obstacle position, the following further processing is performed on each scene position in the virtual scene.
[0084] Specifically, each obstacle position in the virtual scene is taken as the current position one by one, and the second nearby positions within the second specified range of the current position are obtained; for each second nearby position, the following operations are performed:
[0085] If the second nearby position is a non-obstacle position, obtain the fifth distance between the second nearby position and the current position, and the sixth distance between the position indicated by the attribute information of the current position and the current position; based on the magnitude relationship between the fifth distance and the sixth distance, set the attribute information of the current position.
[0086] If the second nearby position is an obstacle position, obtain the seventh distance between the position indicated by the attribute information of the second nearby position and the current position, and the eighth distance between the position indicated by the attribute information of the current position and the current position; based on the magnitude relationship between the seventh distance and the eighth distance, set the attribute information of the current position.
[0087] For example, the coordinates of the current position are (1, 1), the attribute information of the current position is (0, 2, 3), the coordinates of the second nearby position are (2, 3), the second nearby position is a non-obstacle position, and the fifth distance is the square root of (1 2 + 2 2 ), that is, the square root of 5; the sixth distance is the square root of (2 2 + 3 2 ), that is, the square root of 13; the fifth distance is less than the sixth distance, the second nearby position is used as the adjusted position of the current position, and the attribute information of the current position is set to (0, 1, 2).
[0088] For another example, the coordinates of the current position are (1, 1), the attribute information of the current position is (0, 2, 3), the second nearby position is an obstacle position, the coordinates of the second nearby position are (2, 3), and the attribute information of the second nearby position is (0, 1, 2). At this time, the position indicated by the attribute information of the second nearby position is (3, 5); the seventh distance is the square root of (2 2 + 4 2 ), that is, the square root of 20; the position indicated by the attribute information of the current position is (3, 4), and the eighth distance is the square root of (2 2 + 3 2 ), that is, the square root of 13; the seventh distance is greater than the eighth distance, the adjusted position of the current position remains unchanged, and the attribute information of the current position remains unchanged.
[0089] The second nearby positions within the second specified range satisfy the following condition: taking the current position as a reference, the second nearby positions and the current position have a specified second relative distance. For the sake of easy understanding, refer to Figure 4 In the second specified range, the relative direction between the second nearby position and the current position is no longer restricted, so as to traverse more second nearby positions around the current position; Figure 4 In, the bolded grid is the current position; the grids passed by the first circle of dashed lines outside the current position are the positions at a distance of 1 from the current position; the grids passed by the second circle of dashed lines are the positions at a distance of 2 from the current position; the grids passed by the third circle of dashed lines are the positions at a distance of 3 from the current position.
[0090] In actual implementation, the maximum distance from the current position in the second specified range can be set; for example, the maximum distance n = 2, n = 10, etc.; the greater the maximum distance, the greater the possibility of finding the nearest adjusted position near the current position, but the higher the computational complexity. In addition, if the current position is located at the edge of the virtual scene, the second specified range may include positions outside the virtual scene. For positions outside the virtual scene, they are directly skipped and not processed during the search process.
[0091] In a specific implementation manner, based on the adjusted position, generating the attribute information of the obstacle position can be achieved through the following method. Based on the adjusted position and the obstacle position, generate the position offset information with the obstacle position as a reference, and use the position offset information as the attribute information of the obstacle position; wherein, the position offset information is used for: taking the obstacle position as a reference, after performing position offset according to the position offset information, obtaining the adjusted position.
[0092] For example, the coordinates of the obstacle position are (1, 1), and the coordinates of the adjustment position are (4, 5). At this time, based on the obstacle position, the abscissa needs to be offset by 3, and the ordinate needs to be offset by 4 to reach the adjustment position. The position offset information is (3, 4). This position offset information can be used as the attribute information of the obstacle position. In addition, an identifier can be added to the attribute information to indicate that this scene position is an obstacle position. At this time, the attribute information can be expressed as (0, 3, 4), where 0 indicates that this scene position is an obstacle position.
[0093] When determining the final position of the target object through the above position search information, if the attribute information of the initial position includes a first indication identifier, the initial position is determined as the adjusted position of the initial position, and the adjusted position is used as the final position of the target object in the virtual scene; wherein, the first indication identifier is used to: indicate that the initial position is outside the obstacle area; if the attribute information of the initial position includes the relative position information of the adjusted position corresponding to the initial position, the adjusted position is obtained based on the relative position information, and the adjusted position is used as the final position of the target object in the virtual scene.
[0094] For example, the coordinates of the initial position are (1, 1), and the attribute information of the initial position is (0, 3, 3). At this time, the relative position information included in the attribute information is (3, 3), and this relative position information is the position offset information in the foregoing embodiment; through this relative position information, the coordinates of the adjusted position can be obtained as (4, 4), and this adjusted position is the final position of the target object in the virtual scene.
[0095] In the method for determining the object position described above, the final position search information is generated through three steps. Among them, step 1: Determine a non-obstacle position from the virtual scene, and based on this non-obstacle position, set the attribute information for the obstacle positions on the position row and position column to which this non-obstacle position belongs; step 2, traverse the obstacle positions outside the position row and position column, and by searching the nearby positions in eight directions of this obstacle position, obtain the adjusted position closer to the obstacle position, so as to obtain the attribute information of the obstacle position; step 3, traverse each obstacle position in the virtual scene, and by searching the nearby positions in each direction near this obstacle position, obtain the adjusted position closer to the obstacle position, so as to further update the attribute information of the obstacle position.
[0096] The above method can obtain the adjusted position closer to each obstacle position while ensuring a relatively low amount of computation, making the adjusted position more reasonable and having higher applicability.
[0097] In another method, only steps 1 and 2 described above can be executed. At this time, the obtained position search information also includes the adjusted position corresponding to each obstacle position, but the adjusted position at this time may be relatively far from the obstacle position.
[0098] In another way, the above step 3 can be directly executed. For each obstacle position, by searching for the nearby positions in each direction near the obstacle position, the adjusted position of the obstacle position can be obtained. This way can also obtain the adjusted position closer to the obstacle position, but the calculation amount may be relatively high.
[0099] The above method for determining the object position finds a relatively close non-obstacle position for each obstacle position by means of pre-calculation before the game starts. When the randomly generated position during the game is an obstacle position, the nearby non-obstacle position can be directly found through one query and used as the position of the available target object for determining and generating the position of the target object in the game. It solves the problem of manually specifying the non-blocking area when generating a large number of position points, and also avoids the problem that the multiple loop searches and judgments in the related technology when a large number of random points are required in the game will increase the operation pressure of the game.
[0100] Corresponding to the above method embodiment, refer to Figure 5 the structural schematic diagram of a device for determining an object position as shown. The device includes:
[0101] A first determination module 50, configured to determine the initial position of the target object from the virtual scene; wherein, there are obstacles in the virtual scene; the obstacles are located in the obstacle area in the virtual scene; the virtual scene is pre-set with position search information; the position search information includes: the attribute information of each scene position in the virtual scene; the attribute information is used for: providing the search method for the adjusted position corresponding to the scene position; the adjusted position is located outside the obstacle area in the virtual scene;
[0102] A second determination module 52, configured to search for the attribute information of the initial position from the position search information, and determine the final position of the target object in the virtual scene based on the attribute information of the initial position.
[0103] The device for determining the position of the above object determines the initial position of the target object from the virtual scene; wherein, there are obstacles in the virtual scene; the obstacles are located in the obstacle area in the virtual scene; the virtual scene is preset with position search information; the position search information includes: the attribute information of each scene position in the virtual scene; the attribute information is used to provide the search method for the adjusted position corresponding to the scene position; the adjusted position is located outside the obstacle area in the virtual scene; the adjusted position is obtained by automatically searching at least part of the scene positions in the virtual scene; search for the attribute information of the initial position from the position search information, and based on the attribute information of the initial position, determine the final position of the target object in the virtual scene. In this method, the adjusted position corresponding to the scene position is obtained in advance by automatic search, and then the position search information of the virtual scene is obtained, without a large amount of manual operations; when determining the object position, the object position can be obtained by accessing the position search information once, and it can be ensured that the object position is outside the obstacle area. On the one hand, this method can reduce the manual workload, and the acquisition method of the position search information is simple and convenient. On the other hand, it can reduce the computing resources occupied when determining the object position and ensure the smooth operation of the game.
[0104] For the non-obstacle positions outside the obstacle area in the virtual scene, the attribute information of the non-obstacle positions includes a first indication identifier; the first indication identifier is used to: indicate that the non-obstacle position is outside the obstacle area; for the obstacle positions inside the obstacle area, the attribute information of the obstacle positions includes: the relative position information between the obstacle position and the adjusted position corresponding to the obstacle position.
[0105] The above device further includes an information generation module, which is used to generate position search information in the following manner: determine the obstacle area in the virtual scene; for the non-obstacle positions outside the obstacle area, set the attribute information of the non-obstacle positions as the first indication identifier; for the obstacle positions inside the obstacle area, search for the non-obstacle positions with the first indication identifier through a preset search method, and use the found non-obstacle positions as the adjusted positions of the obstacle positions; generate the attribute information of the obstacle positions based on the adjusted positions; use the attribute information of each scene position in the virtual scene as the position search information.
[0106] The above information generation module is further used to: obtain the initial area occupied by the obstacles in the virtual scene; perform an expansion process on the initial area to obtain the obstacle area.
[0107] The above information generation module is further configured to: obtain a non-obstacle position from the virtual scene, and use the obtained non-obstacle position as the reference position; for the first obstacle position in the position row and position column where the reference position is located, use the reference position as the adjustment position of the first obstacle position; for the second obstacle position outside the position row and position column, find the first nearby positions within the first specified range from the second obstacle position, and determine the adjustment position of the second obstacle position according to the non-obstacle positions and / or the attribute information of the obstacle positions among the first nearby positions.
[0108] The above information generation module is further configured to: for the second obstacle position outside the position row and position column, for each of the first nearby positions within the first specified range from the second obstacle position, perform the following operations in sequence: determine whether the first nearby position belongs to a non-obstacle position or an obstacle position; if the first nearby position belongs to a non-obstacle position, determine the adjustment position of the second obstacle position according to the attribute information of the first nearby position; if the first nearby position belongs to an obstacle position and the first nearby position is set with attribute information, determine the adjustment position of the second obstacle position according to the attribute information of the first nearby position.
[0109] The first nearby positions within the above first specified range satisfy the following conditions: taking the second obstacle position as the reference, the first nearby position has a specified relative direction with the second obstacle position, and the first nearby position has a specified first relative distance from the second obstacle position; wherein, the relative directions include: one or more of leftward, rightward, upward, downward, upper leftward, lower leftward, upper rightward, and lower rightward.
[0110] The above information generation module is further configured to: if the first nearby position belongs to a non-obstacle position and the second obstacle position is not currently set with attribute information, determine the first nearby position as the adjustment position of the second obstacle position; if the first nearby position belongs to a non-obstacle position and the second obstacle position is currently set with attribute information, obtain the first distance between the position indicated by the attribute information of the second obstacle position and the second obstacle position, and the second distance between the first nearby position and the second obstacle position; based on the magnitude relationship between the first distance and the second distance, determine the adjustment position of the second obstacle position.
[0111] The above information generation module is further configured to: if the first nearby position belongs to an obstacle position, and the first nearby position is set with attribute information, and the second obstacle position is not currently set with attribute information, obtain the position indicated by the attribute information of the first nearby position, and determine the obtained position as the adjusted position of the second obstacle position; if the first nearby position belongs to an obstacle position, and the first nearby position is set with attribute information, and the second obstacle position is currently set with attribute information, obtain the third distance between the position indicated by the attribute information of the first nearby position and the second obstacle position, and the fourth distance between the position indicated by the attribute information of the second obstacle position and the second obstacle position; based on the magnitude relationship between the third distance and the fourth distance, determine the adjusted position of the second obstacle position.
[0112] The above information generation module is further configured to: sequentially use each obstacle position in the virtual scene as the current position, and obtain second nearby positions within the second specified range of the current position; for each second nearby position, perform the following operations: if the second nearby position is a non-obstacle position, obtain the fifth distance between the second nearby position and the current position, and the sixth distance between the position indicated by the attribute information of the current position and the current position; based on the magnitude relationship between the fifth distance and the sixth distance, set the attribute information of the current position; if the second nearby position is an obstacle position, obtain the seventh distance between the position indicated by the attribute information of the second nearby position and the current position, and the eighth distance between the position indicated by the attribute information of the current position and the current position; based on the magnitude relationship between the seventh distance and the eighth distance, set the attribute information of the current position.
[0113] The second nearby positions within the above second specified range satisfy the following condition: with the current position as the reference, the second nearby position has a specified second relative distance from the current position.
[0114] The above information generation module is further configured to: generate position offset information based on the adjusted position and the obstacle position, and use the position offset information as the attribute information of the obstacle position; wherein, the position offset information is used to: with the obstacle position as the reference, after performing a position offset according to the position offset information, obtain the adjusted position.
[0115] The above second determination module is further configured to: if the attribute information of the initial position includes a first indication identifier, determine the initial position as the adjusted position of the initial position, and use the adjusted position as the final position of the target object in the virtual scene; wherein, the first indication identifier is used to: indicate that the initial position is outside the obstacle area; if the attribute information of the initial position includes the relative position information of the adjusted position corresponding to the initial position, obtain the adjusted position based on the relative position information, and use the adjusted position as the final position of the target object in the virtual scene.
[0116] This embodiment also provides an electronic device, including a processor and a memory. The memory stores machine-executable instructions that can be executed by the processor, and the processor executes the machine-executable instructions to implement the method for determining the position of the above object. The electronic device can be a server or a terminal device.
[0117] As shown in Figure 6 , the electronic device includes a processor 100 and a memory 101. The memory 101 stores machine-executable instructions that can be executed by the processor 100, and the processor 100 executes the machine-executable instructions to implement the method for determining the position of the above object.
[0118] Further, Figure 6 the electronic device shown in also includes a bus 102 and a communication interface 103. The processor 100, the communication interface 103, and the memory 101 are connected through the bus 102.
[0119] Among them, the memory 101 may include a high-speed random access memory (RAM, Random Access Memory), and may also include a non-volatile memory, such as at least one disk memory. Through at least one communication interface 103 (which can be wired or wireless), a communication connection is established between this system network element and at least one other network element, and the Internet, wide area network, local area network, metropolitan area network, etc. can be used. The bus 102 can be an ISA bus, a PCI bus, an EISA bus, etc. The bus can be divided into an address bus, a data bus, a control bus, etc. For the sake of simplicity of representation, Figure 6 only a bidirectional arrow is used in to represent it, but it does not mean that there is only one bus or one type of bus.
[0120] The processor 100 may be an integrated circuit chip with the ability to process signals. In the implementation process, each step of the above method can be completed by the integrated logic circuit of the hardware in the processor 100 or the instructions in the form of software. The above-mentioned processor 100 may be a general-purpose processor, including a central processing unit (CPU for short), a network processor (NP for short), etc.; it may also be a digital signal processor (DSP for short), an application specific integrated circuit (ASIC for short), a field-programmable gate array (FPGA for short), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components. It can implement or execute the various methods, steps, and logic block diagrams disclosed in the embodiments of the present invention. The general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc. The steps of the method disclosed in combination with the embodiments of the present invention can be directly embodied as being executed and completed by the hardware decoding processor, or executed and completed by a combination of the hardware and software modules in the decoding processor. The software module may be located in a mature storage medium in the art such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory, or an electrically erasable programmable memory, a register, etc. This storage medium is located in the memory 101, and the processor 100 reads the information in the memory 101 and combines its hardware to complete the steps of the method in the foregoing embodiments.
[0121] The processor in the above electronic device can implement the following operations in the method for determining the object position by executing machine-executable instructions:
[0122] Determine the initial position of the target object from the virtual scene; wherein, there are obstacles in the virtual scene; the obstacles are located in the obstacle area in the virtual scene; the virtual scene is preset with position search information; the position search information includes: the attribute information of each scene position in the virtual scene; the attribute information is used to provide the search method for the adjustment position corresponding to the scene position; the adjustment position is located outside the obstacle area in the virtual scene; the adjustment position is obtained by automatically searching at least part of the scene positions in the virtual scene; search for the attribute information of the initial position from the position search information, and based on the attribute information of the initial position, determine the final position of the target object in the virtual scene.
[0123] For a non-obstacle position outside the obstacle area in the virtual scene, the attribute information of the non-obstacle position includes a first indication identifier; the first indication identifier is used to: indicate that the non-obstacle position is outside the obstacle area; for an obstacle position within the obstacle area, the attribute information of the obstacle position includes: the relative position information between the obstacle position and the adjusted position corresponding to the obstacle position.
[0124] The above position search information is generated in the following manner: Determine the obstacle area in the virtual scene; for a non-obstacle position outside the obstacle area, set the attribute information of the non-obstacle position as the first indication identifier; for an obstacle position within the obstacle area, search for a non-obstacle position with the first indication identifier through a preset search method, and use the found non-obstacle position as the adjusted position of the obstacle position; generate the attribute information of the obstacle position based on the adjusted position; use the attribute information of each scene position in the virtual scene as the position search information.
[0125] Obtain the initial area occupied by the obstacle in the virtual scene; perform an expansion process on the initial area to obtain the obstacle area.
[0126] Obtain a non-obstacle position from the virtual scene, and use the obtained non-obstacle position as the reference position; for the first obstacle position in the position row and position column where the reference position is located, use the reference position as the adjusted position of the first obstacle position; for the second obstacle position outside the position row and position column, search for the first nearby position within the first specified range from the second obstacle position, and determine the adjusted position of the second obstacle position according to the attribute information of the non-obstacle position and / or the obstacle position in the first nearby position.
[0127] For the second obstacle position outside the position row and position column, for each first nearby position within the first specified range from the second obstacle position, perform the following operations in sequence: Determine whether the first nearby position belongs to a non-obstacle position or an obstacle position; if the first nearby position belongs to a non-obstacle position, determine the adjusted position of the second obstacle position according to the attribute information of the first nearby position; if the first nearby position belongs to an obstacle position and the first nearby position is set with attribute information, determine the adjusted position of the second obstacle position according to the attribute information of the first nearby position.
[0128] The first nearby positions within the above first specified range satisfy the following conditions: Taking the second obstacle position as the reference, the first nearby position has a specified relative direction with the second obstacle position, and the first nearby position has a specified first relative distance from the second obstacle position; where the relative direction includes: one or more of left, right, up, down, upper left, lower left, upper right, and lower right.
[0129] If the first nearby position belongs to a non-obstacle position and the second obstacle position does not currently have attribute information set, determine the adjusted position of the second obstacle position as the first nearby position; if the first nearby position belongs to a non-obstacle position and the second obstacle position currently has attribute information set, obtain the first distance between the position indicated by the attribute information of the second obstacle position and the second obstacle position, and the second distance between the first nearby position and the second obstacle position; based on the magnitude relationship between the first distance and the second distance, determine the adjusted position of the second obstacle position.
[0130] If the first nearby position belongs to an obstacle position, the first nearby position has attribute information set, and the second obstacle position does not currently have attribute information set, obtain the position indicated by the attribute information of the first nearby position, and determine the obtained position as the adjusted position of the second obstacle position; if the first nearby position belongs to an obstacle position, the first nearby position has attribute information set, and the second obstacle position currently has attribute information set, obtain the third distance between the position indicated by the attribute information of the first nearby position and the second obstacle position, and the fourth distance between the position indicated by the attribute information of the second obstacle position and the second obstacle position; based on the magnitude relationship between the third distance and the fourth distance, determine the adjusted position of the second obstacle position.
[0131] Take each obstacle position in the virtual scene as the current position one by one, and obtain the second nearby positions within the second specified range of the current position; for each second nearby position, perform the following operations: if the second nearby position is a non-obstacle position, obtain the fifth distance between the second nearby position and the current position, and the sixth distance between the position indicated by the attribute information of the current position and the current position; based on the magnitude relationship between the fifth distance and the sixth distance, set the attribute information of the current position; if the second nearby position is an obstacle position, obtain the seventh distance between the position indicated by the attribute information of the second nearby position and the current position, and the eighth distance between the position indicated by the attribute information of the current position and the current position; based on the magnitude relationship between the seventh distance and the eighth distance, set the attribute information of the current position.
[0132] The second nearby positions within the above-mentioned second specified range satisfy the following condition: with the current position as the reference, the second nearby position and the current position have a specified second relative distance.
[0133] Generate position offset information based on the adjusted position and the obstacle position, and use the position offset information as the attribute information of the obstacle position; wherein, the position offset information is used to: with the obstacle position as the reference, after performing a position offset according to the position offset information, obtain the adjusted position.
[0134] If the attribute information of the initial position includes a first indication identifier, determine the initial position as the adjusted position of the initial position, and use the adjusted position as the final position of the target object in the virtual scene; wherein, the first indication identifier is used to: indicate that the initial position is outside the obstacle area; if the attribute information of the initial position includes the relative position information of the adjusted position corresponding to the initial position, obtain the adjusted position based on the relative position information, and use the adjusted position as the final position of the target object in the virtual scene.
[0135] The above method for determining the object position determines the initial position of the target object from the virtual scene; wherein, there are obstacles in the virtual scene; the obstacles are located in the obstacle area in the virtual scene; the virtual scene is preset with position search information; the position search information includes: the attribute information of each scene position in the virtual scene; the attribute information is used to provide the search method for the adjusted position corresponding to the scene position; the adjusted position is located outside the obstacle area in the virtual scene; the adjusted position is obtained by automatically searching at least part of the scene positions in the virtual scene; search for the attribute information of the initial position from the position search information, and based on the attribute information of the initial position, determine the final position of the target object in the virtual scene. In this method, the adjusted position corresponding to the scene position is obtained in advance through an automatic search method, and then the position search information of the virtual scene is obtained, without a large amount of manual operations; when determining the object position, the object position can be obtained by accessing the position search information once, and it can be ensured that the object position is outside the obstacle area. On the one hand, this method can reduce the manual workload, and the acquisition method of the position search information is simple and convenient. On the other hand, it can reduce the computing resources occupied when determining the object position and ensure the smooth operation of the game.
[0136] This embodiment also provides a machine-readable storage medium. The machine-readable storage medium stores machine-executable instructions. When the machine-executable instructions are called and executed by a processor, the machine-executable instructions cause the processor to implement the above method for determining the object position.
[0137] The machine-executable instructions stored in the above machine-readable storage medium can, by executing the machine-executable instructions, implement the following operations in the above method for determining the object position:
[0138] Determine the initial position of the target object from the virtual scene; wherein, there are obstacles in the virtual scene; the obstacles are located in the obstacle area in the virtual scene; the virtual scene is preset with position search information; the position search information includes: the attribute information of each scene position in the virtual scene; the attribute information is used to provide the search method for the adjusted position corresponding to the scene position; the adjusted position is located outside the obstacle area in the virtual scene; the adjusted position is obtained by automatically searching at least part of the scene positions in the virtual scene; search for the attribute information of the initial position from the position search information, and based on the attribute information of the initial position, determine the final position of the target object in the virtual scene.
[0139] For non-obstacle positions outside the obstacle area in the virtual scene, the attribute information of the non-obstacle positions includes a first indication flag; the first indication flag is used to: indicate that the non-obstacle position is outside the obstacle area; for obstacle positions within the obstacle area, the attribute information of the obstacle positions includes: the relative position information between the obstacle position and the adjusted position corresponding to the obstacle position.
[0140] The above position search information is generated by the following method: determine the obstacle area in the virtual scene; for non-obstacle positions outside the obstacle area, set the attribute information of the non-obstacle positions as the first indication flag; for obstacle positions within the obstacle area, search for non-obstacle positions with the first indication flag through a preset search method, and use the found non-obstacle positions as the adjusted positions of the obstacle positions; generate the attribute information of the obstacle positions based on the adjusted positions; use the attribute information of each scene position in the virtual scene as the position search information.
[0141] Obtain the initial area occupied by the obstacles in the virtual scene; perform an expansion process on the initial area to obtain the obstacle area.
[0142] Obtain a non-obstacle position from the virtual scene, and use the obtained non-obstacle position as the reference position; for the first obstacle position in the position row and position column where the reference position is located, use the reference position as the adjusted position of the first obstacle position; for the second obstacle position outside the position row and position column, search for the first nearby positions within the first specified range from the second obstacle position, and determine the adjusted position of the second obstacle position according to the attribute information of the non-obstacle positions and / or obstacle positions among the first nearby positions.
[0143] For a second obstacle position other than the position row and the position column, for each first nearby position within a first specified range from the second obstacle position, the following operations are sequentially performed: Determine whether the first nearby position belongs to a non-obstacle position or an obstacle position; if the first nearby position belongs to a non-obstacle position, determine the adjustment position of the second obstacle position according to the attribute information of the first nearby position; if the first nearby position belongs to an obstacle position and the first nearby position is set with attribute information, determine the adjustment position of the second obstacle position according to the attribute information of the first nearby position.
[0144] The first nearby positions within the above-mentioned first specified range satisfy the following conditions: Based on the second obstacle position as a reference, the first nearby position has a specified relative direction with the second obstacle position, and the first nearby position has a specified first relative distance from the second obstacle position; wherein, the relative directions include one or more of: leftward, rightward, upward, downward, upper leftward, lower leftward, upper rightward, and lower rightward.
[0145] If the first nearby position belongs to a non-obstacle position and the second obstacle position is not currently set with attribute information, determine the first nearby position as the adjustment position of the second obstacle position; if the first nearby position belongs to a non-obstacle position and the second obstacle position is currently set with attribute information, obtain the first distance between the position indicated by the attribute information of the second obstacle position and the second obstacle position, and the second distance between the first nearby position and the second obstacle position; based on the magnitude relationship between the first distance and the second distance, determine the adjustment position of the second obstacle position.
[0146] If the first nearby position belongs to an obstacle position, the first nearby position is set with attribute information, and the second obstacle position is not currently set with attribute information, obtain the position indicated by the attribute information of the first nearby position, and determine the obtained position as the adjustment position of the second obstacle position; if the first nearby position belongs to an obstacle position, the first nearby position is set with attribute information, and the second obstacle position is currently set with attribute information, obtain the third distance between the position indicated by the attribute information of the first nearby position and the second obstacle position, and the fourth distance between the position indicated by the attribute information of the second obstacle position and the second obstacle position; based on the magnitude relationship between the third distance and the fourth distance, determine the adjustment position of the second obstacle position.
[0147] Take each obstacle position in the virtual scene as the current position one by one, and obtain the second nearby positions within the second specified range of the current position; for each second nearby position, perform the following operations: If the second nearby position is a non-obstacle position, obtain the fifth distance between the second nearby position and the current position, and the sixth distance between the position indicated by the attribute information of the current position and the current position; based on the magnitude relationship between the fifth distance and the sixth distance, set the attribute information of the current position; If the second nearby position is an obstacle position, obtain the seventh distance between the position indicated by the attribute information of the second nearby position and the current position, and the eighth distance between the position indicated by the attribute information of the current position and the current position; based on the magnitude relationship between the seventh distance and the eighth distance, set the attribute information of the current position.
[0148] The second nearby positions within the above-mentioned second specified range satisfy the following conditions: Taking the current position as the reference, the second nearby position has a specified second relative distance from the current position.
[0149] Generate position offset information based on the adjusted position and the obstacle position, and use the position offset information as the attribute information of the obstacle position; where the position offset information is used to: taking the obstacle position as the reference, after performing a position offset according to the position offset information, obtain the adjusted position.
[0150] If the attribute information of the initial position includes the first indication identifier, determine the initial position as the adjusted position of the initial position, and use the adjusted position as the final position of the target object in the virtual scene; where the first indication identifier is used to: indicate that the initial position is outside the obstacle area; If the attribute information of the initial position includes the relative position information of the adjusted position corresponding to the initial position, obtain the adjusted position based on the relative position information, and use the adjusted position as the final position of the target object in the virtual scene.
[0151] The method for determining the position of the above object determines the initial position of the target object from the virtual scene; wherein, there are obstacles in the virtual scene; the obstacles are located in the obstacle area of the virtual scene; the virtual scene is preset with position search information; the position search information includes: the attribute information of each scene position in the virtual scene; the attribute information is used to provide the search method for the adjusted position corresponding to the scene position; the adjusted position is located outside the obstacle area of the virtual scene; the adjusted position is obtained by automatically searching at least part of the scene positions in the virtual scene; search for the attribute information of the initial position from the position search information, and based on the attribute information of the initial position, determine the final position of the target object in the virtual scene. In this method, the adjusted position corresponding to the scene position is obtained in advance by means of automatic search, and then the position search information of the virtual scene is obtained, without a large amount of manual operations; when determining the object position, the object position can be obtained by accessing the position search information once, and it can be ensured that the object position is located outside the obstacle area. On the one hand, this method can reduce the manual workload, and the acquisition method of the position search information is simple and convenient. On the other hand, it can reduce the computing resources occupied when determining the object position and ensure the smooth operation of the game.
[0152] The computer program product of the method, device, and electronic device for determining the position of an object provided by an embodiment of the present invention includes a computer-readable storage medium storing program code, and the instructions included in the program code can be used to execute the method described in the foregoing method embodiment. For specific implementation, reference can be made to the method embodiment, which will not be elaborated here.
[0153] Those skilled in the art can clearly understand that for the convenience and brevity of description, the specific working processes of the above-described system and device can refer to the corresponding processes in the foregoing method embodiment, which will not be elaborated here.
[0154] In addition, in the description of the embodiments of the present invention, unless otherwise clearly specified and limited, the terms "installation", "connection", and "connection" shall be understood in a broad sense. For example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be directly connected or indirectly connected through an intermediate medium, and it can be the communication inside two components. For those skilled in the art, the specific meanings of the above terms in the present invention can be understood according to specific situations.
[0155] When the above-mentioned functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or a part of this technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in various embodiments of the present invention. The foregoing storage medium includes: various media that can store program codes, such as USB flash drives, mobile hard disks, read-only memories (ROM, Read-Only Memory), random access memories (RAM, Random Access Memory), magnetic disks, or optical discs.
[0156] In the description of the present invention, it should be noted that the orientation or positional relationship indicated by the terms "center", "upper", "lower", "left", "right", "vertical", "horizontal", "inner", "outer", etc. is based on the orientation or positional relationship shown in the drawings. It is only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation. Therefore, it should not be construed as a limitation to the present invention. In addition, the terms "first", "second", "third" are only used for descriptive purposes and cannot be construed as indicating or implying relative importance.
[0157] Finally, it should be noted that the above embodiments are only specific embodiments of the present invention, used to illustrate the technical solutions of the present invention, rather than limiting them. The protection scope of the present invention is not limited thereto. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that: any person skilled in the art within the technical scope disclosed by the present invention can still modify the technical solutions described in the foregoing embodiments, or can easily think of changes, or make equivalent replacements for some of the technical features; and these modifications, changes or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present invention, and should all be covered by the protection scope of the present invention. Therefore, the protection scope of the present invention should be subject to the protection scope of the claims.
Claims
1. A method for determining the position of an object, characterized in that, The method includes: Determining an initial position of a target object from a virtual scene; wherein, there are obstacles in the virtual scene; the obstacles are located in an obstacle area in the virtual scene; the virtual scene is preset with position search information; the position search information includes: attribute information of each scene position in the virtual scene; the attribute information is used to provide a search method for an adjustment position corresponding to the scene position; the adjustment position is located outside the obstacle area in the virtual scene; the adjustment position is obtained by automatically searching at least part of the scene positions in the virtual scene; for a non-obstacle position outside the obstacle area in the virtual scene, the attribute information of the non-obstacle position includes a first indication flag; the first indication flag is used to: indicate that the non-obstacle position is outside the obstacle area; for an obstacle position within the obstacle area, the attribute information of the obstacle position includes: relative position information between the obstacle position and the adjustment position corresponding to the obstacle position; Searching for the attribute information of the initial position from the position search information, and determining a final position of the target object in the virtual scene based on the attribute information of the initial position; The step of determining the final position of the target object in the virtual scene based on the attribute information of the initial position includes: If the attribute information of the initial position includes a first indication flag, determining the initial position as the adjustment position of the initial position, and taking the adjustment position as the final position of the target object in the virtual scene; wherein, the first indication flag is used to: indicate that the initial position is outside the obstacle area; If the attribute information of the initial position includes relative position information of the adjustment position corresponding to the initial position, obtaining the adjustment position based on the relative position information, and taking the adjustment position as the final position of the target object in the virtual scene.
2. The method according to claim 1, wherein The position search information is generated by the following method: Determining the obstacle area in the virtual scene; For a non-obstacle position outside the obstacle area, setting the attribute information of the non-obstacle position as the first indication flag; For an obstacle position within the obstacle area, searching for a non-obstacle position with the first indication flag by a preset search method, and taking the found non-obstacle position as the adjustment position of the obstacle position; Generating the attribute information of the obstacle position based on the adjustment position; Taking the attribute information of each scene position in the virtual scene as the position search information.
3. The method according to claim 2, wherein The step of determining the obstacle area in the virtual scene includes: Obtaining an initial area occupied by the obstacles in the virtual scene; Performing an expansion process on the initial area to obtain the obstacle area.
4. The method according to claim 2, characterized in that, For an obstacle position within the obstacle area, the step of searching for a non-obstacle position with the first indication flag by a preset search method and taking the found non-obstacle position as the adjustment position of the obstacle position includes: Obtain a non-obstacle position from the virtual scene, and use the obtained non-obstacle position as the reference position; For the first obstacle position in the position row and position column where the reference position is located, use the reference position as the adjusted position of the first obstacle position; For the second obstacle position outside the position row and the position column, find the first nearby positions within the first specified range from the second obstacle position, and determine the adjusted position of the second obstacle position according to the non-obstacle positions and / or the attribute information of the obstacle positions among the first nearby positions.
5. The method according to claim 4, wherein The step of finding the first nearby positions within the specified range from the second obstacle position and determining the adjusted position of the second obstacle position according to the non-obstacle positions and / or the attribute information of the obstacle positions among the first nearby positions for the second obstacle position outside the position row and the position column includes: For the second obstacle position outside the position row and the position column, for each first nearby position within the first specified range from the second obstacle position, sequentially perform the following operations: Judge whether the first nearby position belongs to a non-obstacle position or an obstacle position; If the first nearby position belongs to a non-obstacle position, determine the adjusted position of the second obstacle position according to the attribute information of the first nearby position; If the first nearby position belongs to an obstacle position and the first nearby position is set with attribute information, determine the adjusted position of the second obstacle position according to the attribute information of the first nearby position.
6. The method according to claim 5, characterized in that, The first nearby positions within the first specified range satisfy the following conditions: Taking the second obstacle position as the reference, the first nearby position has a specified relative direction with the second obstacle position, and the first nearby position has a specified first relative distance from the second obstacle position; wherein, the relative direction includes one or more of: leftward, rightward, upward, downward, upper leftward, lower leftward, upper rightward, lower rightward.
7. The method according to claim 5, wherein The step of determining the adjusted position of the second obstacle position according to the attribute information of the first nearby position if the first nearby position belongs to a non-obstacle position includes: If the first nearby position belongs to a non-obstacle position and the second obstacle position is not currently set with attribute information, determine the first nearby position as the adjusted position of the second obstacle position; If the first nearby position belongs to a non-obstacle position and the second obstacle position is currently set with attribute information, obtain the first distance between the position indicated by the attribute information of the second obstacle position and the second obstacle position, and the second distance between the first nearby position and the second obstacle position; Based on the magnitude relationship between the first distance and the second distance, determine the adjusted position of the second obstacle position.
8. The method according to claim 5, characterized in that, The step of determining the adjusted position of the second obstacle position according to the attribute information of the first nearby position if the first nearby position belongs to an obstacle position and the first nearby position is set with attribute information includes: If the first nearby position belongs to an obstacle position, and the first nearby position is set with attribute information, and the second obstacle position currently has no attribute information set, obtain the position indicated by the attribute information of the first nearby position, and determine the obtained position as the adjusted position of the second obstacle position; If the first nearby position belongs to an obstacle position, and the first nearby position is set with attribute information, and the second obstacle position currently has attribute information set, obtain the third distance between the position indicated by the attribute information of the first nearby position and the second obstacle position, and the fourth distance between the position indicated by the attribute information of the second obstacle position and the second obstacle position; Based on the magnitude relationship between the third distance and the fourth distance, determine the adjusted position of the second obstacle position.
9. The method according to claim 4, characterized in that, For the second obstacle position outside the position row and the position column, after the step of finding the nearby positions within a specified range from the second obstacle position and determining the adjusted position of the second obstacle position according to the non-obstacle positions and / or the attribute information of the obstacle positions among the nearby positions, the method further includes: Taking each obstacle position in the virtual scene as the current position one by one, and obtaining the second nearby positions within the second specified range of the current position; for each of the second nearby positions, perform the following operations: If the second nearby position is a non-obstacle position, obtain the fifth distance between the second nearby position and the current position, and the sixth distance between the position indicated by the attribute information of the current position and the current position; based on the magnitude relationship between the fifth distance and the sixth distance, set the attribute information of the current position; If the second nearby position is an obstacle position, obtain the seventh distance between the position indicated by the attribute information of the second nearby position and the current position, and the eighth distance between the position indicated by the attribute information of the current position and the current position; based on the magnitude relationship between the seventh distance and the eighth distance, set the attribute information of the current position.
10. The method according to claim 9, characterized in that, The second nearby positions within the second specified range satisfy the following condition: with the current position as the reference, the second nearby position has a specified second relative distance from the current position.
11. The method according to claim 2, wherein The step of generating the attribute information of the obstacle position based on the adjusted position includes: Generating position offset information based on the adjusted position and the obstacle position, and taking the position offset information as the attribute information of the obstacle position; wherein, the position offset information is used for: with the obstacle position as the reference, after performing position offset according to the position offset information, obtaining the adjusted position.
12. A device for determining the position of an object, characterized in that, The device includes: A first determination module, configured to determine an initial position of a target object from a virtual scene; wherein, there are obstacles in the virtual scene; the obstacles are located in an obstacle area in the virtual scene; the virtual scene is preset with position search information; the position search information includes: attribute information of each scene position in the virtual scene; the attribute information is used to provide a search method for an adjustment position corresponding to the scene position; the adjustment position is located outside the obstacle area in the virtual scene; the adjustment position is obtained by automatically searching at least part of the scene positions in the virtual scene; for a non-obstacle position outside the obstacle area in the virtual scene, the attribute information of the non-obstacle position includes a first indication identifier; the first indication identifier is used to: indicate that the non-obstacle position is outside the obstacle area; for an obstacle position within the obstacle area, the attribute information of the obstacle position includes: relative position information between the obstacle position and an adjustment position corresponding to the obstacle position. A second determination module, configured to search for the attribute information of the initial position from the position search information, and determine a final position of the target object in the virtual scene based on the attribute information of the initial position. The second determination module is further configured to, if the attribute information of the initial position includes a first indication identifier, determine the initial position as an adjustment position of the initial position, and use the adjustment position as the final position of the target object in the virtual scene; wherein, the first indication identifier is used to: indicate that the initial position is outside the obstacle area; if the attribute information of the initial position includes relative position information of an adjustment position corresponding to the initial position, obtain the adjustment position based on the relative position information, and use the adjustment position as the final position of the target object in the virtual scene.
13. An electronic device, characterized in that, It includes a processor and a memory, the memory stores machine-executable instructions that can be executed by the processor, and the processor executes the machine-executable instructions to implement the method for determining the object position according to any one of claims 1-11.
14. A machine-readable storage medium, characterized in that, The machine-readable storage medium stores machine-executable instructions, and when the machine-executable instructions are called and executed by a processor, the machine-executable instructions cause the processor to implement the method for determining the object position according to any one of claims 1-11.
Citation Information
Patent Citations
Method and device for dynamically adjusting position of barrier
CN106267818A
Method for Determining Trajectory of Multi-Motor Control System Avoiding Obstacle
US20150081200A1