Role movement control method and device, computer device, and readable storage medium
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- SUZHOU HUANTA NETWORK TECH CO LTD
- Filing Date
- 2023-04-18
- Publication Date
- 2026-08-04
AI Technical Summary
[0004]1、仅适用于特殊地形或者建筑,无法在地形或者建筑墙面停留或者自由改变移动方向,玩家在这种移动中可以进行的操作自由度很低,也无法设计墙面更多的交互和探索的内容
[0017]By utilizing the above technical solutions, this application provides a method, apparatus, computer device, and readable storage medium for controlling the movement of a character. When a virtual character is detected moving along a wall, the application controls the virtual character to move close to the wall based on the physical collision detection results between the virtual character and the wall, and a first movement control command. Furthermore, when a virtual character is detected jumping, the application determines the jumping state of the virtual character based on a second movement control command, the physical collision detection results between the virtual character and the wall, and the direction of movement determined by the second movement control command. This allows the virtual character to not only move freely on the wall but also perform jumps such as wall jumps and reverse wall jumps during movement. This enhances the degree of freedom of operation and enables seamless movement between discontinuous walls, giving the game character life and providing players with a more novel gaming experience.
Smart Images

Figure CN116421975B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of game technology, and in particular to a method, apparatus, computer device, and readable storage medium for controlling the movement of a character. Background Technology
[0002] Climbing, as a way for players to interact with obstacles such as buildings and mountains, is common in various games and virtual world products, especially open-world games. Open-world games are popular with players because they offer a high degree of freedom in interacting with the environment. Some existing games also offer wall-running interaction methods similar to "flying over walls." Unlike the slow movement of climbing in existing games, wall-running can provide players with a fast-paced map-running experience similar to parkour.
[0003] However, the "wall-climbing" interaction method in existing games or virtual world products has the following drawbacks:
[0004] 1. It is only applicable to special terrains or buildings. Players cannot stay on the walls of the terrain or buildings or freely change their direction of movement. The degree of freedom of operation that players can perform during this movement is very low, and it is also impossible to design more interactive and exploratory content on the walls.
[0005] 2. While it's possible to pre-mark points and wires on terrain or building walls during game scene creation, allowing players to stop or freely change direction on these surfaces, this results in a large workload and high production costs. For open-world games, this method of pre-marking points and wires during scene creation is both costly and inefficient, making it difficult to achieve full terrain interaction.
[0006] 3. Some games can achieve full-terrain interaction, but it is generally difficult to move on walls for a long time and in multiple directions. For example, it is impossible to move horizontally. When moving horizontally, the virtual character will gradually move downwards until it touches the ground. It is also impossible to move diagonally upwards or downwards. Furthermore, it is impossible to move seamlessly between discontinuous walls during the movement process.
[0007] Therefore, a solution is needed to implement the "wall-climbing" function that allows for rapid and free movement on walls and is well-adaptable to terrain and scenes, in order to solve the aforementioned problems of existing technologies. Summary of the Invention
[0008] In view of this, this application provides a method, apparatus, computer device, and readable storage medium for controlling the movement of a character.
[0009] According to a first aspect of this application, a method for controlling the movement of a character is provided, the method comprising:
[0010] When it is detected that the virtual character is in a moving state on the wall, according to the physical collision detection result between the virtual character and the wall and the first movement control command, the virtual character is controlled to move close to the wall. The first movement control command is used to control the virtual character to move on the wall.
[0011] When the virtual character is detected to be in a jumping state, the jumping state of the virtual character is determined according to the second movement control command and the physical collision detection result of the wall in the direction of movement of the virtual character determined by the second movement control command. The second movement control command is used to control the virtual character to jump on the wall. The jumping state is used to control the virtual character to perform a jumping action. The jumping state includes at least one of wall jump and reverse wall jump.
[0012] According to a second aspect of this application, a movement control device for a character is provided, the device comprising:
[0013] The control module is used to control the virtual character to move close to the wall when the virtual character is detected to be in a wall-moving state, based on the physical collision detection result between the virtual character and the wall and the first movement control command. The first movement control command is used to control the virtual character to move on the wall.
[0014] The determining module is used to determine the jumping state of the virtual character based on a second movement control command and the physical collision detection result of the wall in the virtual character's movement direction determined by the second movement control command when the virtual character is detected to be in a jumping state. The second movement control command is used to control the virtual character to jump on the wall, and the jumping state is used to control the virtual character to perform a jumping action. The jumping state includes at least one of wall jump and reverse wall jump.
[0015] According to a third aspect of this application, a computer device is provided, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps of the method described in any of the first aspects above.
[0016] According to a fourth aspect of this application, a computer-readable storage medium is provided, on which a computer program is stored, wherein the computer program, when executed by a processor, implements the steps of the method described in any one of the first aspects above.
[0017] By utilizing the above technical solutions, this application provides a method, apparatus, computer device, and readable storage medium for controlling the movement of a character. When a virtual character is detected moving along a wall, the application controls the virtual character to move close to the wall based on the physical collision detection results between the virtual character and the wall, and a first movement control command. Furthermore, when a virtual character is detected jumping, the application determines the jumping state of the virtual character based on a second movement control command, the physical collision detection results between the virtual character and the wall, and the direction of movement determined by the second movement control command. This allows the virtual character to not only move freely on the wall but also perform jumps such as wall jumps and reverse wall jumps during movement. This enhances the degree of freedom of operation and enables seamless movement between discontinuous walls, giving the game character life and providing players with a more novel gaming experience.
[0018] The above description is only an overview of the technical solution of this application. In order to better understand the technical means of this application and to implement it in accordance with the contents of the specification, and to make the above and other objects, features and advantages of this application more obvious and understandable, the following are specific embodiments of this application. Attached Figure Description
[0019] Various other advantages and benefits will become apparent to those skilled in the art upon reading the following detailed description of preferred embodiments. The accompanying drawings are for illustrative purposes only and are not intended to limit the scope of this application. Furthermore, the same reference numerals denote the same parts throughout the drawings. In the drawings:
[0020] Figure 1A This illustration shows a flowchart of a character movement control method provided in an embodiment of this application;
[0021] Figure 1B This illustration shows a schematic diagram of a wall jump according to an embodiment of this application;
[0022] Figure 1C This illustration shows a schematic diagram of an anti-wall jump provided in an embodiment of this application;
[0023] Figure 2A This paper illustrates a flowchart of another role's movement control method provided in an embodiment of this application.
[0024] Figure 2B This illustration shows a schematic diagram of a radiographic testing process provided in an embodiment of this application;
[0025] Figure 2C A schematic diagram of a radiation detection method provided in an embodiment of this application is shown;
[0026] Figure 2DA schematic diagram of a radiation detection method provided in an embodiment of this application is shown;
[0027] Figure 2E A schematic flowchart of another role movement control method provided in an embodiment of this application is shown;
[0028] Figure 2F A schematic diagram of a radiation detection method provided in an embodiment of this application is shown;
[0029] Figure 2G A schematic diagram of a radiation detection method provided in an embodiment of this application is shown;
[0030] Figure 2H A schematic flowchart of another character movement control method provided in an embodiment of this application is shown;
[0031] Figure 2I A schematic diagram of a radiation detection method provided in an embodiment of this application is shown;
[0032] Figure 2J A schematic diagram of a radiation detection method provided in an embodiment of this application is shown;
[0033] Figure 2K A schematic diagram of a radiation detection method provided in an embodiment of this application is shown;
[0034] Figure 2L A schematic diagram of a radiation detection method provided in an embodiment of this application is shown;
[0035] Figure 3 This illustration shows a schematic diagram of the structure of a character movement control device provided in an embodiment of this application;
[0036] Figure 4 A schematic diagram of the device structure of a computer device provided in an embodiment of this application is shown. Detailed Implementation
[0037] Exemplary embodiments of the present application will now be described in more detail with reference to the accompanying drawings. While exemplary embodiments of the present application are shown in the drawings, it should be understood that the present application may be implemented in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this application will be thorough and complete, and will fully convey the scope of the present application to those skilled in the art.
[0038] First, let's introduce the application scenarios to which this application is applicable. This application can be applied to the field of game technology. Specifically, it can be applied to open-world games, or similar open-world games with high degree of freedom and all-terrain interaction, without further specific limitations.
[0039] The technical solution of this application can be applied to single-player games, online games or virtual worlds developed based on game engines. The game engine can be UE4 (Unreal Engine 4), UE5 (Unreal Engine 5), Uniy, etc. This application does not make any specific limitation on it.
[0040] The following example, using the gaming industry, illustrates the existing technical problems:
[0041] Currently, in some games, "wall-running" is essentially just an auxiliary means of wall movement. As the name suggests, "wall-running" includes at least one of the following: wall movement, wall jumping, or wall vaulting. Players have very little freedom of movement when using "wall-running." These games primarily focus on ground-based action or combat, so wall movement isn't a core gameplay element. Furthermore, their level designs generally lack interactive or explorable content on walls, so prolonged wall activity isn't necessary. In contrast, open-world games emphasize exploration and activity within a large open world. Walls often offer more interactive elements, and current wall movement options only involve slow climbing, failing to meet players' needs for extended, long-distance wall movement.
[0042] The existing "wall-climbing" interaction methods in games or virtual world products have the following drawbacks:
[0043] 1. It is only applicable to special terrains or buildings. Players cannot stay on the walls of the terrain or buildings or freely change their direction of movement. The degree of freedom of operation that players can perform during this movement is very low, and it is also impossible to design more interactive and exploratory content on the walls.
[0044] 2. While it's possible to pre-mark points and wires on terrain or building walls during game scene creation, allowing players to stop or freely change direction on these surfaces, this results in a large workload and high production costs. For open-world games, this method of pre-marking points and wires during scene creation is both costly and inefficient, making it difficult to achieve full terrain interaction.
[0045] 3. Some games can achieve full-terrain interaction, but it is generally difficult to move on walls for a long time and in multiple directions. For example, it is impossible to move horizontally. When moving horizontally, the virtual character will gradually move downwards until it touches the ground. It is also impossible to move diagonally upwards or downwards. Furthermore, it is impossible to move seamlessly between discontinuous walls during the movement process.
[0046] Therefore, a solution is needed to implement the "wall-climbing" function that allows for rapid and free movement on walls and is well-adaptable to terrain and scenes, in order to solve the aforementioned problems of existing technologies.
[0047] To address the aforementioned problems, embodiments of this application provide a method for controlling the movement of a character, such as... Figure 1A As shown, the method includes:
[0048] 101. When it is detected that the virtual character is in a state of moving against the wall, according to the physical collision detection results between the virtual character and the wall and the first movement control command, control the virtual character to move close to the wall.
[0049] This application proposes a character movement control method. When a virtual character is detected to be moving along a wall, the method controls the virtual character to move close to the wall based on the physical collision detection results between the virtual character and the wall and a first movement control command. When a virtual character is detected to be jumping, the method determines the jumping state of the virtual character based on a second movement control command and the physical collision detection results between the virtual character and the wall in the direction of movement determined by the second movement control command. This allows the virtual character to not only move freely on the wall but also perform jumping operations such as wall jumps and reverse wall jumps during movement. This improves the degree of freedom of operation and enables seamless movement between discontinuous walls, giving the game character a sense of life and providing players with a more novel gaming experience.
[0050] In this embodiment, when a virtual character is detected to be moving along a wall, the virtual character is controlled to move close to the wall based on the physical collision detection results between the virtual character and the wall, and the first movement control command. The wall can be a movable surface within a scene composed of elements such as terrain, buildings, plants, animals, NPCs (Non-Player Characters), bosses (powerful enemies at a certain stage in the game), or elements like plants, fire, water, and clouds. The first movement control command controls the virtual character's movement along the wall. This command can be initiated by the player, specifically by the player inputting control commands on their device to move the virtual character. The input process can be completed on a mobile UI, a computer mouse and keyboard, or other host devices such as gamepads, eye-tracking devices, or human-computer interfaces. In other words, when a virtual character is detected to be moving along a wall, the player-initiated first movement control command controls the virtual character to move close to the wall, allowing the virtual character to explore various corners the player wants to reach. There are various ways to move close to the wall, such as feet, hands, and feet simultaneously; no specific limitation is made here.
[0051] 102. When the virtual character is detected to be in a jumping state, the jumping state of the virtual character is determined according to the second movement control command and the physical collision detection results of the wall in the movement direction of the virtual character determined by the second movement control command.
[0052] In this embodiment, while controlling the virtual character to move freely on the wall, the player can also control the virtual character to jump. Specifically, the player can issue a second movement control command to instruct the jump. Taking a mobile interface UI as an example, the second movement control command can be issued by a direction control UI component or a specific jump UI component; no specific limitation is made here. Thus, for the game, upon detecting that the virtual character is in a jumping state, the game determines the virtual character's jumping state based on the second movement control command and the physical collision detection results of the wall in the virtual character's movement direction determined by the second movement control command. The second movement control command is an interactive control command issued by the player to control the virtual character to jump on the wall; the jumping state is used to control the virtual character to perform a jumping action, and the jumping state includes at least one of wall jump and reverse wall jump.
[0053] Specifically, as an example, wall jumping can be seen in [reference needed]. Figure 1B ,like Figure 1B As shown, the virtual character moves normally on wall ① in the direction it is facing. When it reaches the edge of wall ①, the virtual character jumps in the direction it is facing, jumping from wall ① to wall ②, which is located in the direction of the virtual character's movement but is discontinuous, and continues to move in the direction it is facing. Jumping on continuous walls that are on different planes follows the same process; that is, there is no gap between wall ① and wall ②. In addition, there are some continuous walls that are not on the same plane in the game, such as concave corner walls, convex corner walls, etc. On such walls, the process described above can also be used to control the virtual character to jump from one wall to another, or the virtual character can be controlled to walk directly across the junction of two walls, allowing the virtual character to continue moving freely on another wall.
[0054] As an example, the reverse wall jump can be seen in [reference needed]. Figure 1C ,like Figure 1C As shown, the virtual character jumps while moving normally in the direction it is facing on wall ③, and jumps from wall ③ to wall ④, which is on a different plane and not connected to wall ③, and continues to move in the direction it is facing.
[0055] It's important to note that whether it's a wall jump or a reverse wall jump, the jump status needs to be determined by judging the virtual character's movement direction, the virtual camera's orientation, or even by combining the virtual character's movement direction with the virtual camera's orientation. Specific data for determining the movement direction includes at least one or more of the following motion direction parameters: the virtual character's movement vector, the horizontal / vertical components of the movement vector, and the direction of acceleration. Data for determining the virtual camera's orientation includes at least one or more orientation parameters such as pitch, roll, and yaw.
[0056] The method provided in this application embodiment, when detecting that a virtual character is in a wall-moving state, controls the virtual character to move close to the wall based on the physical collision detection results between the virtual character and the wall and the first movement control command. Furthermore, when detecting that the virtual character is in a jumping state, the method determines the jumping state of the virtual character based on the second movement control command and the physical collision detection results of the wall in the direction of movement determined by the virtual character and the second movement control command. This allows the virtual character to not only move freely on the wall but also to perform jumps when encountering specific wall terrain during movement, such as wall jumps and reverse wall jumps. This enhances the degree of freedom of operation and enables seamless movement between discontinuous walls or different planar walls, giving the game character life and providing players with a more novel gaming experience.
[0057] Furthermore, as a refinement and extension of the specific implementation methods of the above embodiments, and in order to fully illustrate the specific implementation process of this embodiment, this application provides another method for controlling the movement of a role, such as... Figure 2A As shown, the method includes:
[0058] 201. When it is detected that the virtual character is in a wall-moving state, a ray detection is performed in front of the virtual character based on the collider of the virtual character to determine the distance between the collider and the obstacle. If the distance is less than or equal to the radius of the collider, the following step 202 is executed; if the distance is greater than the radius of the collider, the following step 203 is executed.
[0059] The technical solution of this application is generally divided into three parts: ray detection, character movement, and motion rendering. Ray detection is mainly used to detect various corners and obstacles. Ray detection is a common industry method and is not specifically limited here. Character movement is achieved by calculating the current direction and speed of the character's movement and using the character movement component or motion component in the game engine to realize the continuous movement of the wall. Motion rendering is achieved using animation blueprints, state machines, etc. For certain connecting actions, such as entering a flying wall-running position, montage can be used.
[0060] In this embodiment, when the virtual character is detected to be in a wall-moving state, the virtual character is controlled to move close to the wall based on the physical collision detection results between the virtual character and the wall and the first movement control command. In practical applications, since "wall-climbing" can be an extension of climbing, providing a more flexible movement method based on climbing, the triggering of "wall-climbing" can be consistent with climbing. That is, when entering climbing, it is checked whether the virtual character has the wall-climbing state. If so, it directly enters the wall-climbing state. That is, when it is determined that the virtual character is detected to be in a wall-moving state, the virtual character can be controlled to move on the wall. "Wall-climbing" can also be distinguished from the climbing state triggering and act as an independent state triggering. That is, after the detection conditions between the virtual character and the wall are met, the virtual character enters the "wall-climbing" state, and the virtual character can be controlled to move on the wall. Specifically, in the game, after the virtual character enters the "wall-climbing" state, i.e., the wall-moving state, the terrain detection can be started every frame so that corresponding processing can be performed according to the detection results.
[0061] The first movement control command is used to control the virtual character's movement on the wall. This command can be initiated by the player. That is, when the game engine detects that the virtual character is moving against the wall, it will control the virtual character's movement based on the player's first movement control command, allowing the virtual character to reach the various corners the player wants to explore. Specifically, when controlling the virtual character to move close to the wall based on the physical collision detection results between the virtual character and the wall, and the first movement control command, it first needs to perform ray detection in front of the virtual character based on the collider of the virtual character to determine the distance between the collider and the obstacle. This distance also serves as the basis for adjusting the virtual character's movement close to the wall. Based on the distance, it is determined whether the virtual character is attached to an obstacle or has detached from the wall and needs to move closer to it, thus completing the adjustment to maintain close contact. The collider of the virtual character is used to perform collision detection and ray detection. Specifically, it can be a capsule, cuboid, etc., constructed based on the virtual character. This application does not limit the specific form of the collider.
[0062] Specifically, if the distance is less than or equal to the radius of the collider, it means that the virtual character is close to the wall. It can be further determined whether the wall is suitable for movement and if it is suitable for movement, the virtual character can be controlled to move freely on the wall, that is, step 202 is executed below; if the distance is greater than the radius of the collider, it means that the virtual character has left the wall and needs to move closer to the wall, that is, step 203 is executed below.
[0063] 202. When the distance is less than or equal to the radius of the collider, perform ray detection on the obstacle based on the collider, and when the physical collision detection result returned based on the ray detection indicates that movement on the surface of the obstacle is allowed, treat the obstacle as a wall, determine the movement direction indicated by the first movement control command input to the virtual character, and control the virtual character to move close to the wall in the movement direction.
[0064] In this embodiment, if the distance is less than or equal to the radius of the collider, it indicates that the virtual character is pressed against the wall. Further determination can be made as to whether the wall is suitable for movement, and if so, the virtual character can be controlled to move freely on the wall. Therefore, ray detection of obstacles based on the collider is required. The specific ray detection process is as follows:
[0065] First, it is necessary to perform ray detection from the collider of the virtual character towards the target side of the virtual character, and obtain the detection results returned by the ray detection. The target side is either the left or right side of the virtual character. Specifically, during ray detection, the center of the collider can be used as the starting point, and ray detection can be performed horizontally towards the target side of the virtual character. Taking the left side of the virtual character as an example, the center of the collider can be used as the starting point, and ray detection can be performed horizontally towards the left side of the virtual character to determine whether there are obstacles such as walls on the left side of the virtual character. It should be noted that ray detection can also be performed from the waist, hand, or other parts of the collider; this application does not specifically limit this approach.
[0066] Next, if the detection result indicates that an obstacle has been detected, it means that the virtual character is at an inward corner. Further analysis of the detection result is needed to determine whether the obstacle is suitable for wall-climbing. Therefore, it is necessary to obtain the obstacle's attributes based on the detection result, and if the obstacle's attributes indicate that wall-climbing is permitted, the obstacle is treated as a wall surface. Additionally, it is necessary to receive physical collision detection results indicating that movement on the wall surface is permitted. Here, "wall-climbing" means moving on the wall surface.
[0067] If the detection result indicates that no obstacle was detected, it means that there is no obstacle on the target side of the virtual character, and ray detection needs to continue. Therefore, a reference point is selected behind the target side of the collider, and ray detection is performed from the reference point in the direction the virtual character is facing, and the detection results returned based on the ray detection are obtained. Continuing with the example of the target side being the left side of the virtual character, a reference point can be selected behind the left side of the collider, and ray detection can be performed horizontally in the direction the virtual character is facing, starting from this reference point.
[0068] Accordingly, if the detection result indicates that an obstacle has been detected, it means that there is an obstacle in front of the target side of the virtual character. It is necessary to continue detecting the obstacle's attributes, and if the obstacle's attributes indicate that climbing onto a wall is permitted, the obstacle is designated as a wall, and the physical collision detection result indicating permission to move on the wall's surface is confirmed. Conversely, if the detection result indicates that no obstacle has been detected, it means that no obstacle has been detected. Therefore, it is necessary to select a reference point in front of the target side of the colliding object, and from this reference point, perform ray detection towards the other side of the virtual character, obtaining the detection results returned by the ray detection. Based on the detection results, the wall is determined, and it is determined whether movement on the wall's surface is permitted. The other side is either the left or right side of the collider, excluding the target side. For example, if the left side of the virtual character is taken as the target side, then the other side is the right side of the virtual character. Detection needs to continue from the front of the collider towards the right side of the collider. Specifically, during ray detection, if the detection result indicates an obstacle is detected, it means the virtual character is currently at an outward corner. The obstacle's properties need to be determined based on the ray detection results. If the obstacle's properties indicate that climbing onto a wall is allowed, the obstacle is designated as the wall, and movement on the wall's surface is permitted. If the detection result indicates no obstacle is detected, ray detection is performed from the collider towards the other side of the virtual character, and the ray detection results are obtained. Based on the results, it is determined whether to select a reference point behind the other side of the collider and perform ray detection in the direction the virtual character is facing, and obtain the ray detection results. Based on the results, it is determined whether to select a reference point in front of the other side of the collider in the direction of the virtual character's target side and perform ray detection, thereby identifying the wall and determining whether movement on the wall's surface is permitted. It should be noted that the process of selecting a reference point behind the other side and selecting a reference point in front of the other side for ray detection is the same as the process of selecting a reference point on the target side described above. Furthermore, the process of determining whether to identify the wall and whether to allow movement on the surface of the wall based on the returned ray detection results is the same as the evaluation performed on the target side described above, and will not be repeated here.
[0069] By performing the above ray detection process, the exact location of the wall relative to the collider can be determined, thus determining the direction of movement indicated by the first movement control command input to the virtual character. The virtual character is then controlled to move along the wall in that direction. This first movement control command is used to control the virtual character's movement along the wall. This command can be initiated by the player; that is, when the virtual character is detected moving along the wall, the player-initiated first movement control command will control the virtual character to move along the wall, allowing the virtual character to reach the various corners the player wants to explore. For the game, the first movement control command is received based on interactive controls, which include at least one of directional interactive controls and jump interactive controls.
[0070] Additionally, in some cases, even if the virtual character is already pressed against the wall, the current posture pressed against the wall may not be suitable for moving along the wall. Therefore, it may be necessary to rotate the virtual character to adjust its posture. The specific process of rotating the virtual character is as follows:
[0071] First, the collider needs to be divided into equal parts from top to bottom to obtain multiple parts. Specifically, the collider can be divided into 2, 3, 4, etc. This application does not specify the number of equal parts.
[0072] Subsequently, a fan-shaped region with a first preset angle needs to be constructed in front of each part, and ray detection needs to be performed every second preset angle in the fan-shaped region of each part, resulting in a ray matrix composed of fan-shaped regions corresponding to multiple parts. Specifically, the first preset angle can be set to 120 degrees, and the second preset angle can be set to 6 degrees. When performing ray detection, ray detection needs to be performed every 6 degrees in a fan-shaped region 120 degrees in front of each part towards the virtual character, thus forming a 4×20 ray matrix.
[0073] Next, a longitudinal scan of the ray reticle is performed to obtain the pitch angle of the virtual character, and a lateral scan of the ray reticle is performed to obtain the yaw angle of the virtual character. Specifically, the pitch angle is a component of the virtual character's rotation angle and can be considered as the virtual character's pitch angle; the yaw angle is a component of the virtual character's rotation angle and can be considered as the virtual character's yaw angle.
[0074] Finally, the pitch angle and yaw angle are used as the character rotation parameters of the virtual character, and the virtual character is rotated according to the character rotation parameters so that the virtual character moves close to the wall.
[0075] In summary, the X-ray detection process involved in step 202 is summarized as follows: Figure 2BAs shown, taking the left side of the collider as the target side and the right side as the collider as the other side, ray detection is performed on the left side of the virtual character based on the collider to determine if an obstacle is detected. If an obstacle is detected, and the obstacle's attribute indicates that climbing is allowed, the obstacle is used as the wall, and the virtual character is rotated according to the character's rotation parameters to make the virtual character stick to the wall and move freely on the wall. If no obstacle is detected, a reference point is selected behind the left side of the collider, and ray detection is performed from the reference point in the direction the virtual character is facing. When the detection result indicates that an obstacle is detected, and the obstacle's attribute indicates that climbing is allowed, the obstacle is used as the wall, and the virtual character is rotated according to the character's rotation parameters to make the virtual character stick to the wall and move freely on the wall. When the detection result indicates that no obstacle is detected, or the obstacle's attribute indicates that climbing is not allowed, the rotation of the virtual character stops, a reference point is selected in front of the left side of the collider, and ray detection is performed from the reference point in the direction the virtual character is facing. Accordingly, if the detection result indicates that an obstacle has been detected, and the obstacle's attributes indicate that climbing onto the wall is allowed, the obstacle is used as the wall and the virtual character is rotated according to the character rotation parameters so that the virtual character is close to the wall and can move freely on the wall. If the detection result indicates that no obstacle has been detected, or the obstacle's attributes indicate that climbing onto the wall is not allowed, the ray detection operation on the left is repeated in the opposite direction on the right side of the virtual character, and the character rotation parameters are determined according to the detection result. The virtual character is then rotated according to the character rotation parameters so that the virtual character is close to the wall and can move freely on the wall.
[0076] In fact, as can be seen from the above process, different ray detection strategies are required for convex and concave corners, as follows: For convex corners, such as... Figure 2C As shown, the first ray detection is performed to the left of the virtual character, but no wall is detected. Therefore, a reference point needs to be selected behind the left side of the virtual character, and ray detection is performed from the reference point in the direction the virtual character is facing. Figure 2C The second detection is shown in the image. If the second detection still does not detect a wall, a reference point needs to be selected in front of the left side of the virtual character. A ray detection is then performed from this reference point to the right side of the virtual character to determine the walls that can be freely moved. Figure 2C The third test is shown in the image. For concave corners, such as... Figure 2D As shown, the first detection is a ray detection to the left of the virtual character, which can directly detect the wall and control the virtual character to move on the wall.
[0077] 203. When the distance is greater than the radius of the collider, perform ray detection on the obstacle based on the collider, and when the physical collision detection result returned based on the ray detection indicates that movement on the surface of the obstacle is allowed, treat the obstacle as a wall and control the virtual character to move closer to the wall so that the virtual character is close to the wall, and determine the movement direction indicated by the first movement control command input to the virtual character, and control the virtual character to move close to the wall in the movement direction.
[0078] In this embodiment, when the distance is greater than the radius of the collider, it indicates that the virtual character has detached from the wall and needs to move closer to it. Therefore, it is necessary to perform ray detection on the obstacle based on the collider. When the physical collision detection result returned based on the ray detection indicates that movement on the obstacle surface is permitted, the obstacle is treated as a wall, and the virtual character is controlled to move closer to the wall so that the virtual character is pressed against the wall. The movement direction indicated by the first movement control command input to the virtual character is determined, and the virtual character is controlled to move close to the wall according to the movement direction. The specific process of determining whether movement on the obstacle surface is permitted based on ray detection is the same as the process described in step 202 above, and will not be repeated here. Alternatively, the process described in step 202 above can be used, by calculating the character rotation parameters and rotating the virtual character according to the character rotation parameters to make the virtual character press against the wall. The process of calculating the character rotation parameters will not be repeated here.
[0079] Thus, through the processes in steps 201 to 203 above, the effect of controlling the virtual character to move close to the wall is achieved when the virtual character is detected to be in a moving state against the wall, based on the physical collision detection results between the virtual character and the wall and the first movement control command.
[0080] In this embodiment of the application, when it is detected that the virtual character is in a moving state on the wall, the virtual character is controlled to move close to the wall according to the physical collision detection result between the virtual character and the wall and the first movement control command, so that the virtual character can move freely on the wall, improve the degree of freedom of operation, give life to the game character, and bring players a more novel game experience.
[0081] This application not only provides the function of free movement on walls, but also the function of jumping on walls. That is, when the virtual character moves on a wall, the player can issue interactive control commands to the virtual character to control the virtual character to jump during the movement, realizing complex and novel operations such as jumping across walls and jumping against walls. Therefore, the embodiments of this application provide another method for controlling the movement of a character, such as... Figure 2E As shown, the method includes:
[0082] 204. When it is detected that the virtual character is in a jumping state, the jumping state of the virtual character is determined according to the second movement control command and the physical collision detection result of the wall in the movement direction of the virtual character determined by the second movement control command.
[0083] In this embodiment, while controlling the virtual character to move freely on the wall, the player can also control the virtual character to jump. Specifically, the player can issue a second movement control command to instruct the character to jump. Thus, for the game, upon detecting that the virtual character is in a jumping state, the game determines the virtual character's jumping state based on the second movement control command and the physical collision detection results of the wall in the direction the virtual character moves, as determined by the second movement control command.
[0084] The second movement control command is issued by the player to control the virtual character's jumping on walls. Similar to the first movement control command, the second movement control command can be received based on interactive controls, including at least one of directional interactive controls and jump interactive controls. The jump state controls the virtual character to perform a jumping action, including at least one of wall jump and reverse wall jump. Specifically, a wall jump is the process of jumping across discontinuous walls, that is, jumping from the current wall to another wall in the same direction but discontinuous during movement. A reverse wall jump is the process of jumping in the opposite direction to another wall in a different direction. The player can indicate the direction of the jump by issuing the second movement control command, causing the virtual character to perform either a wall jump or a reverse wall jump. The process of determining the different jump states of the virtual character is described below:
[0085] For wall jumps, raycasting based on the virtual character's collider is required to detect whether there is a wall in front of the virtual character's current position. If raycasting determines that there is a wall in front of the virtual character's current position, it means that after jumping, the virtual character can still land on the wall where they are currently moving, and has not reached the wall's boundary. Therefore, the virtual character is controlled to land on the wall and continue moving close to the wall. If raycasting determines that there is no wall in front of the virtual character's current position, it means that the current character has reached the boundary of the current wall and needs to jump to another wall. Therefore, it is necessary to determine the other wall adjacent to the current wall. When the object distance between the other walls meets the virtual character's jump distance, the virtual character is controlled to land on the other wall and move close to the other wall. In actual application, in the game engine, when the player jumps over a wall, as long as the current input, that is, the second movement control command issued by the player, does not contain a downward movement component, the wall jump process will begin. In the game engine, when jumping over a wall, the virtual character will move at a faster speed for about 1 second according to the current movement direction on the wall, ignoring the player's directional input during this time. Moreover, even after leaving the wall, the jump will not end immediately, but will check whether there is another wall in front of the virtual character when the jump time is up. This allows the virtual character to seamlessly cross between two discontinuous walls. Therefore, in practical applications, the jump movement vector based on the second movement control command input can be determined. When it is detected that the jump movement vector has no downward movement component, the jump timer is started, and the virtual character is controlled to jump on the surface of the wall object. When the jump timer reaches the preset duration, ray detection is performed based on the collider of the virtual character to detect whether there is a wall in front of the virtual character's current position.
[0086] For wall jumps, raycasting based on the virtual character's collider is required to detect whether there are obstacles in front of the virtual character's current position. If raycasting determines that there is an obstacle in front of the virtual character's current position, it means that after jumping in the opposite direction, there is an obstacle that the virtual character can land on, and it is also possible to jump from one wall to another wall opposite it. Therefore, when the obstacle's properties indicate that wall jumping is allowed, the virtual character needs to be controlled to land on the obstacle and move close to the obstacle. If raycasting determines that there is no obstacle in front of the virtual character's current position, it means that after jumping in the opposite direction, there is no obstacle that the virtual character can land on, and the virtual character can only return to the ground. Therefore, the virtual character needs to be controlled to land back on the ground and move on the ground. In practical applications, within the game engine, the opposite of wall jump, as long as there is a downward component during the jump (the virtual character's AxisMoveForward property is less than 0), a reverse wall jump will occur. During a reverse wall jump, the virtual character will jump and move in the opposite direction of the wall for about 1 second, and simultaneously turn to the direction of movement. Similar to wall jump, the running state does not immediately end after leaving the wall, but instead checks the surrounding walls at the end, enabling seamless crossing of walls behind. Therefore, in practical applications, the jump movement vector based on the interactive control input can be determined. When a downward component of the jump movement vector is detected, the jump direction indicated by the interactive control instruction is determined, and a jump timer is started. The virtual character is controlled to turn to the jump direction and jump from the surface of the wall object. Then, when the jump timer reaches the preset duration, it is detected whether there is an obstacle in front of the virtual character's current position and whether a reverse wall jump can be achieved.
[0087] It should be noted that in actual application, whether it is a wall jump or a reverse wall jump, a jump timer does not need to be set. Obstacle detection can start directly after the virtual character takes off, or it can start after the timer has not been reached or after a period of time has been exceeded. This application does not impose specific limitations on this.
[0088] In addition, in the game, whenever the virtual character leaves the wall in the "wall-climbing" state, the use of weapons and items will be deactivated, making it easier for players to use grappling hooks and other items for more free operation when away from the wall.
[0089] 205. Control the virtual character to perform a jump operation according to the jump status.
[0090] In this embodiment of the application, after determining the jumping state of the virtual character, the virtual character can be controlled to perform a jumping operation, thereby realizing the animation performance of the virtual character in the game.
[0091] In another alternative implementation, during the process of controlling the virtual character to move close to the wall and performing a jump, this application will continuously detect whether the virtual character is too close to the ground and, if it is determined that the virtual character is too close to the ground, control the virtual character to end the wall movement state and return to the ground. That is, when the virtual character is on the wall, the distance between the virtual character and the ground will be detected in real time. Specifically, a detection point is determined behind the collider, and ray detection is performed within a second distance below the collider from the detection point, and the detection result returned based on the ray detection is obtained. The value of the second distance is equal to a preset multiple of the collider height, which can be 0.8 times. If the detection result indicates the existence of an obstacle and the obstacle's attributes indicate that the obstacle allows movement, the normal vector value carried by the detection result is obtained, and the angle between the normal vector value and the vertical axis of the world coordinate system is calculated. If the angle is less than a preset angle, the virtual character is controlled to leave the wall and the virtual character is controlled to end the wall movement state and return to the ground. A feasible detection method in a game engine, such as Figure 2F As shown, the specific procedure involves detecting an obstacle approximately one capsule radius behind the virtual character (opposite to HorizontalForward) and downwards (opposite to ActorUpVector) at a height approximately 0.8 times that of the capsule (i.e., the collider). If an obstacle is detected, it is further determined whether the obstacle is walkable. If so, the angle between the obstacle's normal vector value and the world coordinate system's vertical axis (UpVector) is calculated to see if it is less than 45 degrees. If it is less than 45 degrees, the ground inclination is considered suitable for standing. If all checks pass, the virtual character will immediately end the wall-running state. It should be noted that if the detection result indicates no obstacle or the angle is greater than or equal to a preset angle, it means the virtual character is not too close to the ground. Therefore, the virtual character can be controlled to continue moving close to the wall.
[0092] In another alternative implementation, during the process of controlling the virtual character to move close to the wall and performing a jump, this application also continuously detects whether the virtual character is suspended in the air and controls the virtual character to end the wall-moving state and return to the ground. Suspension detection mainly detects whether there is still a wall in front of the virtual character. Specifically, it involves using the collider of the virtual character as a starting point, performing ray detection in the direction the virtual character is currently facing, and obtaining the detection results returned based on the ray detection. If the detection result indicates that there is no obstacle at a location where the distance between the collider and the collider is equal to a preset distance, then the current state of the virtual character is obtained, where the preset distance is equal to twice the radius of the collider. If the current state of the virtual character is a jump state, upon detecting the end of the jump state, the virtual character is controlled to end the wall-moving state and return to the ground; if the current state of the virtual character is a running state, the virtual character is controlled to return to the ground and run. In a game engine, such as... Figure 2G As shown, the above detection can start from the position of the virtual character's collider and take the virtual character's current orientation as the direction. If there is no wall within a distance of twice the radius of the collider, the virtual character is considered to be suspended in the air. When the virtual character is suspended in the air, it is determined whether to end the wall-running state based on the current state. If the current state is jumping, such as jumping over a wall or jumping against a wall, the state will wait until the jump is over before ending. If the current state is running, the "wall-running" state will end immediately.
[0093] Thus, through the technical solution of this application embodiment, players can achieve long-distance and highly free wall movement in an open world, and can achieve seamless jumping and connection on discontinuous walls, giving players a brand-new wall parkour experience.
[0094] In this embodiment, when the virtual character is detected to be in a jumping state, the jumping state of the virtual character is determined according to the second movement control command and the physical collision detection result of the wall in the direction of movement of the virtual character determined by the second movement control command. This allows the virtual character to not only move freely on the wall, but also to perform jumping operations such as wall jumps and reverse wall jumps during the movement. While improving the degree of freedom of operation, it also enables seamless movement between discontinuous walls, giving the game character vitality and bringing players a more novel gaming experience.
[0095] While moving close to the wall, players are likely to control the virtual character to move to the top of the wall, which is one of the effects of "wall-climbing." To make the character's movement more realistic, in this embodiment, while controlling the virtual character to move close to the wall, it continuously detects whether the virtual character has reached the top of the wall and climbed over it. Therefore, this embodiment provides another method for controlling character movement, such as... Figure 2H As shown, the method includes:
[0096] 206. While controlling the virtual character to move close to the wall, continuously perform ray detection from the top of the virtual character's collider towards the front of the virtual character, and obtain the detection results returned by the ray detection.
[0097] In this embodiment, while controlling the virtual character to move close to the wall, ray detection is continuously performed from the top of the virtual character's collider towards the front of the virtual character, and the detection results returned by the ray detection are obtained. This ray detection is also known as outcrop detection. Figure 2I As shown, a ray is emitted from the virtual character's head to detect whether there is a wall in front of the virtual character. If there is no wall, further detection will be performed to climb over it.
[0098] 207. If the detection results indicate that there are no obstacles, start from half a height above the top of the collider of the virtual character and perform ray detection within a preset distance in front of the virtual character, and obtain the detection results returned based on the ray detection.
[0099] In this embodiment, if the detection result indicates that there are no obstacles, it can be assumed that there is no wall in front of the virtual character, and further climbing confirmation can be performed. Therefore, it is necessary to perform ray detection from half a height above the top of the collider of the virtual character within a preset distance in front of the virtual character, and obtain the detection result returned based on the ray detection. The preset distance is equal to twice the radius of the collider. Figure 2J As shown, starting from half a height above the virtual character's head, the detection extends to a radius twice in front of the virtual character to determine whether the depth of the space in front of the virtual character is sufficient to stand. Accordingly, only when it is determined that the depth of the space in front is sufficient to stand will the selection of a foothold continue.
[0100] 208. If the detection result indicates that there are no obstacles, determine the landing point of the virtual character, calculate the target position of the virtual character based on the landing point, and control the virtual character to enter the vaulting state at the target position so that the virtual character lands after vaulting.
[0101] In this embodiment of the application, if the detection result indicates that there is no obstacle, it means that no wall was detected and the space in front of the virtual character is deep enough to allow the virtual character to stand. Therefore, it is necessary to determine the landing point of the virtual character and calculate the target position of the virtual character based on the landing point. At the target position, the virtual character is controlled to enter the vaulting state so that the virtual character lands after vaulting.
[0102] In determining the landing point, a virtual collider with a radius equal to the radius of the collider needs to be constructed above the wall. Starting from the bottom of the virtual collider, ray detection is performed vertically downwards, and the detection results returned by the ray detection are obtained. Specifically, if the detection results indicate the existence of ground and the ground properties indicate that standing is permitted, the point of contact between the ray detection and the ground is taken as the landing point. In practical applications, sphere, capsule, or cube detection methods can be used. Taking sphere detection as an example, see [link to details]. Figure 2K Create a sphere with a radius equal to the radius of the collider as a virtual collider. The starting point is above the wall, and the detection direction is vertically downward. If the ground is detected, further information about the ground is obtained. If the detected ground is a place where one can stand or walk, it is considered that a place to stand has been found.
[0103] See also Figure 2K Once a landing point is found, the target position of the virtual character needs to be calculated. Specifically, a preset offset distance needs to be determined. Starting from the landing point, the character moves upwards by the preset offset distance to obtain the target position. The preset offset distance is equal to half the height of the collider. Next, the virtual character is controlled to move towards the target position, and the system continuously checks for obstacles between the virtual character and the target position. If no obstacle exists, and the distance between the virtual character's current position and the target position is less than a distance threshold, the virtual character enters a vaulting state, allowing it to land after vaulting. In practical applications, in a game engine, the landing point detected in the previous step (the Impact Point in the game engine) can be used as the landing point. Moving the character upwards by half the height of the collider (Capsule Half Height) yields the target position, during which the virtual character enters a vaulting state, involving two displacements. Figure 2L As shown, the first segment depicts the virtual character moving towards its own ActorUpVector direction, while continuously checking whether there is still occlusion between itself and the target position, i.e., moving until it reaches the target position. Figure 2L The middle position. Next, as... Figure 2LAs shown, once there are no obstructions, the next stage of movement can begin, which involves moving directly towards the target location. The movement direction is a vector calculated by subtracting the current virtual character's position from the target position. The movement ends when the virtual character's position and the target position are close to or less than a distance threshold. It should be noted that all player input is ignored throughout the entire movement process.
[0104] In this embodiment, while controlling the virtual character to move close to the wall, continuous ray detection is performed from the top of the virtual character's collider towards the front of the virtual character, and the detection results returned by the ray detection are obtained. If the detection results indicate that there are no obstacles, ray detection is performed from half a height above the top of the virtual character's collider towards a preset distance in front of the virtual character, and the detection results returned by the ray detection are obtained. If the detection results indicate that there are no obstacles, the landing point of the virtual character is determined, and the target position of the virtual character is calculated based on the landing point. At the target position, the virtual character is controlled to enter a vaulting state so that the virtual character lands after vaulting. This allows the virtual character to not only move freely on the wall, but also to determine whether it has reached the top of the wall and vault over it during the movement. This improves the freedom of operation while ensuring the realism of the game action, giving the game character vitality and bringing players a more novel gaming experience.
[0105] Furthermore, as Figure 1A To specifically implement the method, this application embodiment provides a character movement control device, such as... Figure 3 As shown, the device includes a control module 301 and a determination module 302.
[0106] The control module 301 is used to control the virtual character to move close to the wall when the virtual character is detected to be in a wall-moving state, based on the physical collision detection result between the virtual character and the wall and the first movement control command. The first movement control command is used to control the virtual character to move on the wall.
[0107] The determining module 302 is used to determine the jumping state of the virtual character based on a second movement control command and the physical collision detection result of the wall in the movement direction of the virtual character determined by the second movement control command when the virtual character is detected to be in a jumping state. The second movement control command is used to control the virtual character to jump on the wall. The jumping state is used to control the virtual character to perform a jumping action. The jumping state includes at least one of jumping over a wall and jumping against a wall.
[0108] In specific application scenarios, the first movement control command or the second movement control command is received based on an interactive control, which includes at least one of a directional interactive control and a jump interactive control.
[0109] In specific application scenarios, the control module 301 is used to perform ray detection on the virtual character's front based on the collider of the virtual character, and determine the distance between the collider and the obstacle; when the distance is less than or equal to the radius of the collider, perform ray detection on the obstacle based on the collider, and when the physical collision detection result returned based on the ray detection indicates that movement on the surface of the obstacle is permitted, use the obstacle as the wall, determine the movement direction indicated by the first movement control command input to the virtual character, and control the virtual character to move close to the wall in the movement direction; when the distance is greater than the radius of the collider, perform ray detection on the obstacle based on the collider, and when the physical collision detection result returned based on the ray detection indicates that movement on the surface of the obstacle is permitted, use the obstacle as the wall, control the virtual character to move closer to the wall so that the virtual character is close to the wall, and determine the movement direction indicated by the first movement control command input to the virtual character, and control the virtual character to move close to the wall in the movement direction.
[0110] In a specific application scenario, the control module 301 is used to perform ray detection on the target side of the virtual character based on the collider of the virtual character, and to obtain the detection result returned based on the ray detection, wherein the target side is the left or right side of the virtual character; if the detection result indicates that an obstacle has been detected, then when the attribute of the obstacle indicates that it is allowed to go on the wall, the obstacle is taken as the wall surface, and it is determined that the physical collision detection result indicating that movement on the surface of the wall surface is allowed has been received.
[0111] In specific application scenarios, the control module 301 is further configured to: if the detection result indicates that no obstacle is detected, select a reference point behind the target side of the collider, perform ray detection from the reference point in the direction the virtual character is facing, and obtain the detection result returned based on the ray detection; if the detection result indicates that an obstacle is detected, and the obstacle's attribute indicates that it is allowed to climb the wall, use the obstacle as the wall surface, and determine that the physical collision detection result indicating that movement on the surface of the wall is allowed is received; if the detection result indicates that no obstacle is detected, select a reference point in front of the target side of the collider, perform ray detection from the reference point in the direction of the other side of the virtual character, and obtain the detection result returned based on the ray detection, determine the wall surface based on the detection result, and determine whether movement on the surface of the wall is allowed, wherein the other side is the side of the left or right side of the collider other than the target side.
[0112] In a specific application scenario, the control module 301 is used to, if the detection result indicates that an obstacle has been detected, and the attribute of the obstacle indicates that climbing is allowed, designate the obstacle as the wall and determine that movement is allowed on the surface of the wall; if the detection result indicates that no obstacle has been detected, perform ray detection on the other side of the virtual character based on the collider, and obtain the detection result returned based on the ray detection, determine whether to select a reference point behind the other side of the collider and perform ray detection in the direction the virtual character is facing based on the detection result, and obtain the detection result returned based on the ray detection, and determine whether to select a reference point in front of the other side of the collider and perform ray detection in the direction of the target side of the virtual character based on the detection result, thereby determining the wall and determining whether movement is allowed on the surface of the wall.
[0113] In a specific application scenario, the determining module 302 is used to perform ray detection based on the collision body of the virtual character to detect whether there is a wall in front of the current position of the virtual character; if the ray detection determines that there is a wall in front of the current position of the virtual character, then the virtual character is controlled to land on the wall, and the virtual character is controlled to continue moving close to the wall.
[0114] In a specific application scenario, the determining module 302 is used to perform ray detection based on the collision body of the virtual character to detect whether there is an obstacle in front of the current position of the virtual character; if the ray detection determines that there is an obstacle in front of the current position of the virtual character, then when the attribute of the obstacle indicates that it allows climbing, the virtual character is controlled to land on the obstacle, and the virtual character is controlled to move close to the obstacle.
[0115] In a specific application scenario, the control module 301 is also used to continuously perform ray detection from the top of the collider of the virtual character towards the front of the virtual character while controlling the virtual character to move close to the wall, and to obtain the detection results returned based on the ray detection; when the detection results indicate that there are no obstacles, ray detection is performed from half a height above the top of the collider of the virtual character towards a preset distance in front of the virtual character, and the detection results returned based on the ray detection are obtained, wherein the preset distance is equal to twice the radius of the collider; if the detection results indicate that there are no obstacles, the landing point of the virtual character is determined, and the target position of the virtual character is calculated based on the landing point, and the virtual character is controlled to enter a vaulting state at the target position so that the virtual character lands after vaulting.
[0116] In a specific application scenario, the control module 301 is used to construct a virtual collider with a radius equal to the radius of the collider above the wall, perform ray detection vertically downwards starting from the bottom of the virtual collider, and obtain the detection results returned based on the ray detection; under the condition that the detection results indicate the existence of ground and the properties of the ground indicate that standing is allowed, the contact point between the ray detection and the ground is taken as the landing point; a preset offset distance is determined, and the target position is obtained by moving the preset offset distance directly upwards from the landing point, the value of the preset offset distance being equal to half the height of the collider; the virtual character is controlled to move towards the target position, and the virtual character is continuously detected to see if there are any obstacles between the virtual character and the target position; if there are no obstacles between the virtual character and the target position, the virtual character is controlled to enter a vaulting state under the condition that the distance between the current position of the virtual character and the target position is less than a distance threshold, so that the virtual character lands after vaulting.
[0117] In specific application scenarios, the control module 301 is also used to continuously detect the foot state of the virtual character during the process of controlling the virtual character to move close to the wall and controlling the virtual character to perform a jump operation, and to control the virtual character to continue to be in the wall-moving state or end the wall-moving state and return to the ground according to the foot state.
[0118] In a specific application scenario, the control module 301 is used to determine a detection point behind the collider, perform ray detection from the detection point to a second distance below the collider, and obtain the detection result returned based on the ray detection, wherein the value of the second distance is equal to a preset multiple of the collider height; if the detection result indicates the existence of an obstacle and the obstacle's attributes indicate that the obstacle allows movement, then the normal vector value carried by the detection result is obtained, and the angle between the normal vector value and the vertical axis of the world coordinate system is calculated; if the angle is less than a preset angle, the virtual character is controlled to leave the wall and the virtual character is controlled to end the wall movement state and return to the ground; if the detection result indicates that there is no obstacle or the angle is greater than or equal to the preset angle, then the virtual character is controlled to continue moving close to the wall.
[0119] In a specific application scenario, the control module 301 is used to perform ray detection from the collider of the virtual character towards the direction the virtual character is currently facing, and to obtain the detection result returned based on the ray detection; if the detection result indicates that there is no obstacle at a position where the distance between the virtual character and the collider is equal to a preset distance, then the current state of the virtual character is obtained, wherein the preset distance is equal to twice the radius of the collider; if the current state of the virtual character is a jumping state, then upon detecting the end of the jumping state, the virtual character is controlled to end the wall movement state and return to the ground; if the current state of the virtual character is a running state, the virtual character is controlled to return to the ground and run.
[0120] The device provided in this application, when detecting that a virtual character is in a wall-moving state, controls the virtual character to move close to the wall based on the physical collision detection results between the virtual character and the wall and the first movement control command. Furthermore, when detecting that the virtual character is in a jumping state, it determines the jumping state of the virtual character based on the second movement control command and the physical collision detection results between the virtual character and the wall in the direction of movement determined by the second movement control command. This allows the virtual character to not only move freely on the wall but also perform jumping operations such as wall jumps and reverse wall jumps during movement. While increasing the degree of freedom of operation, it also enables seamless movement between discontinuous walls, giving the game character life and providing players with a more novel gaming experience.
[0121] It should be noted that other corresponding descriptions of the functional units involved in the role movement control device provided in this application embodiment can be found by referring to... Figures 1A to 1C and Figures 2A to 2L The corresponding descriptions in [the document] will not be repeated here.
[0122] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties.
[0123] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0124] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of this patent application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this application should be determined by the appended claims.
[0125] In an exemplary embodiment, see Figure 4 The invention also provides a computer device including a bus, a processor, a memory, and a communication interface. It may also include an input / output interface and a display device, wherein the various functional units can communicate with each other via the bus. The memory stores a computer program, and the processor executes the program stored in the memory to perform the character movement control method described in the above embodiments.
[0126] A computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the steps of the movement control method for the character.
[0127] Through the above description of the embodiments, those skilled in the art can clearly understand that this application can be implemented in hardware or by using software plus necessary general-purpose hardware platforms. Based on this understanding, the technical solution of this application can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (such as a CD-ROM, USB flash drive, external hard drive, etc.) and includes several instructions to cause a computer device (such as a personal computer, server, or network device, etc.) to execute the methods described in the various embodiments of this application.
[0128] Those skilled in the art will understand that the accompanying drawings are merely schematic diagrams of a preferred embodiment, and the modules or processes shown in the drawings are not necessarily essential for implementing this application.
[0129] Those skilled in the art will understand that the modules in the apparatus of the implementation scenario can be distributed within the apparatus of the implementation scenario as described, or they can be located in one or more apparatuses different from this implementation scenario, with corresponding changes. The modules of the above-described implementation scenario can be combined into one module, or they can be further divided into multiple sub-modules.
[0130] The serial numbers in this application are for descriptive purposes only and do not represent the superiority or inferiority of the implementation scenario.
[0131] The above disclosures are only a few specific implementation scenarios of this application. However, this application is not limited to these. Any variations that can be conceived by those skilled in the art should fall within the protection scope of this application.
Claims
1. A method for controlling the movement of a character, characterized in that, include: When it is detected that the virtual character is in a moving state on the wall, according to the physical collision detection result between the virtual character and the wall and the first movement control command, the virtual character is controlled to move close to the wall. The first movement control command is used to control the virtual character to move on the wall. When the virtual character is detected to be in a jumping state, the jumping state of the virtual character is determined according to the second movement control command and the physical collision detection result of the wall in the direction of movement of the virtual character determined by the second movement control command. The second movement control command is used to control the virtual character to jump on the wall. The jumping state is used to control the virtual character to perform the jumping action. The jumping state includes at least one of wall jump and reverse wall jump. A wall jump means that the virtual character jumps from the current wall to a wall located in the direction of movement of the virtual character but not connected to the current wall, or it means that the virtual character jumps from the current wall to a wall located in the direction of movement of the virtual character and connected to the current wall but on a different plane. A reverse wall jump means that the virtual character jumps from the current wall to a wall on a different plane and not connected to the current wall. Specifically, when determining the jumping state of the virtual character, ray detection is performed based on the collider of the virtual character to detect whether the current position of the virtual character has reached the boundary of the current wall or whether there is an obstacle. If the ray detection determines that the current position of the virtual character has reached the boundary of the current wall, the jumping state is determined to be a wall jump. If the ray detection determines that there is an obstacle in front of the current position of the virtual character, the jumping state is determined to be a wall jump.
2. The method according to claim 1, characterized in that, The first or second movement control command is received based on an interactive control, which includes at least one of a directional interactive control and a jump interactive control.
3. The method according to claim 1 or 2, characterized in that, The step of controlling the virtual character to move close to the wall based on the physical collision detection results between the virtual character and the wall and the first movement control command includes: Based on the collider of the virtual character, a ray detection is performed in front of the virtual character to determine the distance between the collider and the obstacle; Under the condition that the distance is less than or equal to the radius of the collider, the obstacle is ray-detected based on the collider, and when the physical collision detection result returned based on the ray detection indicates that movement on the surface of the obstacle is allowed, the obstacle is taken as the wall, the movement direction indicated by the first movement control command input to the virtual character is determined, and the virtual character is controlled to move close to the wall in the movement direction; Under the condition that the distance is greater than the radius of the collider, the obstacle is ray-detected based on the collider, and when the physical collision detection result returned based on the ray detection indicates that movement on the surface of the obstacle is allowed, the obstacle is used as the wall, and the virtual character is controlled to move closer to the wall so that the virtual character is close to the wall, and the movement direction indicated by the first movement control command input to the virtual character is determined, and the virtual character is controlled to move close to the wall in the movement direction.
4. The method according to claim 3, characterized in that, The ray detection of the obstacle based on the collider includes: The system performs ray detection on the target side of the virtual character based on the collider of the virtual character, and obtains the detection result returned based on the ray detection, wherein the target side is the left or right side of the virtual character; If the detection result indicates that an obstacle has been detected, then when the properties of the obstacle indicate that it is permissible to climb onto the wall, the obstacle is designated as the wall surface, and it is determined that the physical collision detection result indicating that movement on the surface of the wall surface is permitted is received.
5. The method according to claim 4, characterized in that, After performing ray detection on the target side of the virtual character based on the collider of the virtual character, and obtaining the detection result returned by the ray detection, the method further includes: If the detection result indicates that no obstacle was detected, a reference point is selected behind the target side of the colliding object, and ray detection is performed from the reference point in the direction the virtual character is facing, and the detection result returned based on the ray detection is obtained. When the detection result indicates that an obstacle has been detected, and when the properties of the obstacle indicate that climbing onto the wall is permitted, the obstacle is taken as the wall surface, and it is determined that the physical collision detection result indicating that movement on the surface of the wall surface is permitted is received; If the detection result indicates that no obstacle is detected, a reference point is selected in front of the target side of the collider. Starting from the reference point, ray detection is performed in the direction of the other side of the virtual character, and the detection result returned based on the ray detection is obtained. The wall is determined according to the detection result, and it is determined whether movement on the surface of the wall is allowed. The other side is the side of the left or right side of the collider other than the target side.
6. The method according to claim 5, characterized in that, The step of determining the wall surface and whether movement on the surface of the wall is permitted based on the detection results includes: If the detection result indicates that an obstacle has been detected, then if the properties of the obstacle indicate that climbing onto the wall is permitted, the obstacle is designated as the wall surface, and it is determined that movement is permitted on the surface of the wall surface. If the detection result indicates that no obstacle was detected, then a ray detection is performed on the other side of the virtual character based on the collider, and the detection result returned based on the ray detection is obtained. Based on the detection result, it is determined whether to select a reference point behind the other side of the collider and perform ray detection in the direction the virtual character is facing, and the detection result returned based on the ray detection is obtained. Based on the detection result, it is determined whether to select a reference point in front of the other side of the collider and perform ray detection in the direction of the target side of the virtual character, thereby determining the wall and whether movement on the surface of the wall is allowed.
7. The method according to claim 1 or 2, characterized in that, Determining the jumping state of the virtual character includes: Ray detection is performed based on the collider of the virtual character to detect whether the current position of the virtual character has reached the boundary of the current wall. If ray detection determines that the virtual character's current position has not reached the boundary of the current wall, then the virtual character is controlled to land on the wall, and the virtual character is controlled to continue moving close to the wall.
8. The method according to claim 1 or 2, characterized in that, Determining the jumping state of the virtual character includes: Ray detection is performed based on the collider of the virtual character to detect whether there is an obstacle in front of the current position of the virtual character; If ray detection determines that there is an obstacle in front of the current location of the virtual character, then when the obstacle's attribute indicates that climbing is allowed, the virtual character is controlled to land on the obstacle, and the virtual character is controlled to move close to the obstacle.
9. The method according to claim 1 or 2, characterized in that, The method further includes: While controlling the virtual character to move close to the wall, ray detection is continuously performed from the top of the virtual character's collider towards the front of the virtual character, and the detection results returned based on the ray detection are obtained; Under the condition that the detection result indicates that there is no obstacle, ray detection is performed from half the height above the top of the collider of the virtual character to a preset distance in front of the virtual character, and the detection result returned based on the ray detection is obtained, wherein the preset distance is equal to twice the radius of the collider; If the detection result indicates that there are no obstacles, then the landing point of the virtual character is determined, and the target position of the virtual character is calculated based on the landing point. At the target position, the virtual character is controlled to enter a vaulting state so that the virtual character lands after vaulting.
10. The method according to claim 9, characterized in that, The steps of determining the landing point of the virtual character, calculating the target position of the virtual character based on the landing point, and controlling the virtual character to enter a vaulting state at the target position so that the virtual character lands after vaulting include: A virtual collider with a radius equal to that of the collider is constructed above the wall. A ray detection is performed vertically downwards from the bottom of the virtual collider, and the detection results returned based on the ray detection are obtained. If the detection result indicates the presence of ground and the properties of the ground indicate that standing is permitted, the point of contact between the ray-detected surface and the ground shall be taken as the footing point. Determine a preset offset distance, and starting from the landing point, move the preset offset distance directly upwards to obtain the target position. The value of the preset offset distance is equal to half the height of the colliding body. Control the virtual character to move towards the target location, and continuously detect whether there are obstacles between the virtual character and the target location; If there are no obstacles between the virtual character and the target location, then if the distance between the current location of the virtual character and the target location is less than a distance threshold, the virtual character is controlled to enter a vaulting state so that the virtual character lands after vaulting.
11. The method according to claim 1 or 2, characterized in that, The method further includes: During the process of controlling the virtual character to move close to the wall and performing a jump, the system continuously monitors the state of the virtual character's feet and controls the virtual character to continue moving along the wall or end the wall movement and return to the ground based on the state of the feet.
12. The method according to claim 11, characterized in that, The continuous detection of the virtual character's foot position, and the control of the virtual character to continue in the wall-moving state or end the wall-moving state and return to the ground based on the foot position, includes: A detection point is determined behind the collider. Starting from the detection point, a ray detection is performed within a second distance below the collider, and the detection result returned based on the ray detection is obtained. The value of the second distance is equal to a preset multiple of the height of the collider. If the detection result indicates the existence of an obstacle and the attributes of the obstacle indicate that the obstacle allows movement, then obtain the normal vector value carried by the detection result and calculate the angle between the normal vector value and the vertical axis of the world coordinate system. When the included angle is less than a preset angle, control the virtual character to leave the wall and control the virtual character to end the wall movement state and return to the ground; If the detection result indicates that there is no obstacle or the included angle is greater than or equal to the preset angle, the virtual character is controlled to continue moving close to the wall.
13. The method according to claim 11, characterized in that, The continuous detection of the virtual character's foot position, and the control of the virtual character to continue in the wall-moving state or end the wall-moving state and return to the ground based on the foot position, includes: Starting from the collider of the virtual character, perform ray detection in the direction the virtual character is currently facing, and obtain the detection results returned based on the ray detection; If the detection result indicates that there is no obstacle at a position where the distance between the object and the collider is equal to a preset distance, then the current state of the virtual character is obtained, wherein the preset distance is equal to twice the radius of the collider; If the virtual character is currently in a jumping state, when the jumping state is detected to have ended, control the virtual character to end the wall movement state and return to the ground. If the virtual character is currently in a running state, control the virtual character to return to the ground and continue running.
14. A character movement control device, characterized in that, include: The control module is used to control the virtual character to move close to the wall when the virtual character is detected to be in a wall-moving state, based on the physical collision detection result between the virtual character and the wall and the first movement control command. The first movement control command is used to control the virtual character to move on the wall. A determining module is configured to, upon detecting that the virtual character is in a jumping state, determine the jumping state of the virtual character based on a second movement control command and the physical collision detection results of the walls along the virtual character's movement direction determined by the second movement control command. The second movement control command is used to control the virtual character to jump on walls. The jumping state is used to control the virtual character to perform a jumping action. The jumping state includes at least one of wall jump and reverse wall jump. A wall jump refers to the virtual character jumping from its current wall to a wall located in the virtual character's movement direction but not continuous with the current wall, or jumping from its current wall to a wall located in the virtual character's movement direction and continuous with the current wall but on a different plane. A reverse wall jump refers to the virtual character jumping from its current wall to a wall on a different plane and not connected to the current wall. Specifically, when determining the jumping state of the virtual character, ray detection is performed based on the collider of the virtual character to detect whether the current position of the virtual character has reached the boundary of the current wall or whether there is an obstacle. If the ray detection determines that the current position of the virtual character has reached the boundary of the current wall, the jumping state is determined to be a wall jump. If the ray detection determines that there is an obstacle in front of the current position of the virtual character, the jumping state is determined to be a wall jump.
15. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 13.
16. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 13.