Virtual character variable gravity adjusting method and device and medium
By responding to changes in gravity state of virtual characters and optimizing functional components to adjust their gravity state, the limitations of dynamic gravity gameplay in the open world in the prior art are solved, and diversified gravity adjustment and immersive gaming experiences in the open world are achieved.
Patent Information
- Application Number
- CN202411310774.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-19
- Publication Date
- 2025-01-10
AI Technical Summary
The existing dynamic gravity gameplay has limitations in third-person games. It cannot effectively adapt to various terrains in the open world, and lacks mutual cooperation with other gameplays, making it impossible to achieve an immersive open world gaming experience.
By responding to changes in gravity state of the virtual character, obtaining its motion state, and determining the control parameters of the functional components affected by gravity based on the motion state, optimize the functional components to adjust the gravity state of the virtual character, so that it can achieve dynamic gravity adaptation in the open world, Supports diversified gravity adjustment needs.
It realizes diversified gravity adjustment of virtual characters in the open world, enhances the gaming experience, supports effective scenes and action skills in various terrains, meets users' diverse gravity calling needs, and provides a more realistic and physical game experience.
Smart Images

Figure CN119280822A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present invention relate to the field of Internet technology, and in particular to a method, device and medium for adjusting variable gravity of a virtual character. Background Art
[0002] Currently, third-person games with dynamic gravity gameplay include "Bayonetta" and "Gravity Rush". The former can only have dynamic gravity effects in specific terrains, with many restrictions, and players cannot actively change gravity; the latter uses gravity change as the main gameplay, but the terrain is relatively simple and lacks combat processes;
[0003] In the above games, dynamic gravity is either a limited auxiliary gameplay or a single gameplay, which does not cooperate with other gameplays in the game. In large-scale open world game projects, players are faced with an open world where they can freely explore, solve puzzles, and fight. Therefore, a dynamic gravity implementation solution is needed that can support good adaptation to various terrains. After changing the gravity, players can experience the chain effect of gravity changes on other gameplays in the open world, such as movement, combat, skill casting, etc., so as to achieve the goal of immersive open world games. Summary of the invention
[0004] The embodiments of the present invention provide a method, device and medium for adjusting the variable gravity of a virtual character, so as to realize a solution that meets the diverse gravity adjustment requirements of users.
[0005] In a first aspect, an embodiment of the present invention provides a method for adjusting variable gravity of a virtual character, the method comprising:
[0006] In response to the virtual character gravity state change instruction, obtaining the motion state of the virtual character in the virtual scene;
[0007] Determining control parameters of functional components affected by gravity according to the motion state, wherein the functional components include one or more of a movement component for controlling movement of the virtual character and a skill component for controlling release of skills of the virtual character;
[0008] On the virtual scene terrain where the virtual character moves, the first character state related to the current gravity of the virtual character is adjusted to a second character state related to the target gravity by using the functional component after the control parameter optimization.
[0009] In a second aspect, an embodiment of the present invention further provides an electronic device, comprising a processor and a memory, wherein the memory stores at least one instruction, at least one program, a code set or an instruction set, and the at least one instruction, at least one program, a code set or an instruction set is loaded and executed by the processor to implement the method described in the first aspect.
[0010] In a third aspect, an embodiment of the present invention further provides a computer-readable medium on which is stored at least one instruction, at least one program, a code set or an instruction set, and the at least one instruction, at least one program, a code set or an instruction set is loaded and executed by a processor to implement the method described in the first aspect.
[0011] In an embodiment of the present invention, in an open world game scene, a user can control a virtual character to freely explore, solve puzzles, and fight. The virtual environment is varied and can provide users with effective scenes of various terrains. The virtual character can also perform various action skills in the virtual environment. Therefore, a scheme for adaptively changing the gravity of the virtual character according to the virtual scene terrain where the virtual character is located and the motion state in the virtual scene is proposed. Determine the motion state of the virtual character in the virtual scene and the virtual scene terrain where the virtual character is located in the virtual scene; determine the control parameters of the functional component affected by gravity according to the motion state; on the virtual scene terrain where the virtual character moves, use the functional component after the control parameter optimization to adjust the first character state related to the current gravity of the virtual character to the second character state related to the target gravity. Through the above scheme, when the user controls the virtual character to move in the virtual environment, the second character state of the virtual character is determined according to the target gravity direction. Use the target character state to optimize the functional component, and use the optimized functional component to change the motion gravity direction and / or skill gravity direction of the virtual character in the virtual scene. Due to the implementation of this technical solution, there is no need to modify the underlying parameters, and the users (e.g., game players) can set them according to their needs, which can meet the users' diverse gravity calling needs, thereby providing users with a better gaming experience. BRIEF DESCRIPTION OF THE DRAWINGS
[0012] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0013] Figure 1 A schematic diagram of a structure for adjusting the variable gravity of a virtual character provided in an embodiment of the present application;
[0014] Figure 2 A schematic diagram of a moving target gravity detection ray for illustrating an embodiment of the present application;
[0015] Figure 3a A schematic diagram of a falling target gravity detection ray provided in an embodiment of the present application;
[0016] Figure 3b A schematic diagram of another falling target gravity detection ray provided in an embodiment of the present application;
[0017] Figure 4 A schematic diagram of a four-probe calculation scheme proposed in an embodiment of the present application;
[0018] Figure 5a , 5b 5c is a schematic diagram of a target gravity detection ray array provided in an embodiment of the present application;
[0019] Figure 6 A schematic diagram of the actual falling distance provided in the embodiment of the present application;
[0020] Figure 7 A schematic diagram of the structure of a variable gravity adjustment device for a virtual character provided in an embodiment of the present application;
[0021] Figure 8 A schematic diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0022] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0023] The terms used in the embodiments of the present invention are only for the purpose of describing specific embodiments, and are not intended to limit the present invention. The singular forms "a", "said" and "the" used in the embodiments of the present invention and the appended claims are also intended to include plural forms, unless the context clearly indicates other meanings, and "multiple" generally includes at least two.
[0024] As used herein, the words "if" and "if" may be interpreted as "at the time of" or "when" or "in response to determining" or "in response to detecting", depending on the context. Similarly, the phrases "if it is determined" or "if (stated condition or event) is detected" may be interpreted as "when it is determined" or "in response to determining" or "when detecting (stated condition or event)" or "in response to detecting (stated condition or event)", depending on the context.
[0025] In addition, the step sequence in the following method embodiments is only an example and not a strict limitation.
[0026] With the development of game technology, in order to meet the diverse game experience of users, various innovations are made in the game scene, so that users can get a real and novel game experience. In existing games, in order to enable users to obtain a more realistic game experience, a gravity environment will be set in the game scene. As a result, when users manipulate the game characters, they can experience an experience effect that is closer to the real world. However, in some game scenes, for example, a virtual character with special climbing skills requires the virtual character to have the ability to fly over eaves and walls. It is necessary to adjust the gravity performance of the virtual character. Since the default environment gravity is used in the development process of existing games, the basic parameters in the game engine are relatively solidified, and developers generally do not need to modify them. As a game user, you have no right to modify gravity-related parameters. Therefore, a solution that can meet the diverse gravity changes of virtual characters in the game is needed.
[0027] Terminology explanation:
[0028] CharacterMovementComponent: The character movement component provided by the UE4 engine. Since UE4 adopts a component-based design approach, the GamePlay framework provided by UE4 provides developers with a relatively perfect mobile solution to solve the most core basic operation of player movement. The core function of this mobile solution is completed by the mobile component MovementComponent.
[0029] ECollisionChannel::ECC_Terrain: A custom collision channel for gravity terrain detection. All the terrain detection for climbing in this article uses the ECollisionChannel::ECC_Terrain collision channel.
[0030] UKismetSystemLibrary: A public method library in UE4. The detection methods used in this solution are all derived from this library.
[0031] Pitch: A component of the object's rotation angle, which refers to the object's pitch angle.
[0032] Yaw: A component of the object's rotation angle, which refers to the object's horizontal rotation angle.
[0033] Roll: A component of an object's rotation angle, referring to the object's rolling angle.
[0034] ControlRotation: The angle of the player's controller, used to determine the player's current movement direction and camera orientation.
[0035] RotationBase: The base rotation of the player, calculated using the current gravity. It only changes if gravity changes.
[0036] GetViewRotation: The method by which the player obtains the viewing angle. Overriding this method can customize the player's viewing direction, and the player's viewing angle determines the player's movement direction.
[0037] Quat: Quaternion, often used to represent rotation in 3D space.
[0038] FRotationMatrix::MakeFromZY(VectorZ,VectorY): A method provided by UE to construct a rotation angle, indicating that the Z axis of the new angle points in the direction of the parameter VectorZ, and the Y axis points in the direction of VectorY.
[0039] PhysWalking: The method in CharacterMovementComponent that is responsible for the player's walking logic. This method simulates the walking / driving speed changes of characters or vehicles under physical gravity.
[0040] PhysFalling: The method in CharacterMovementComponent responsible for the player's falling logic. This method simulates the change in speed of a character or vehicle falling under physical gravity.
[0041] To facilitate understanding, specific embodiments will be used as examples below.
[0042] like Figure 1 The flowchart of the variable gravity adjustment method for a virtual character provided in the embodiment of the present application is shown in FIG. The method can be applied to an open world game scene, and the game user can adjust the motion state of the virtual character as needed, thereby making corresponding adjustments to the gravity of the virtual character. Figure 1 As can be seen in the figure, the method specifically includes the following steps:
[0043] Step 101: In response to a virtual character gravity state change instruction, the motion state of the virtual character in the virtual scene is obtained.
[0044] Step 102: Determine control parameters of functional components affected by gravity according to the motion state, wherein the functional components include one or more of a movement component for controlling the movement of the virtual character and a skill component for controlling the release of skills of the virtual character.
[0045] Step 103: On the virtual scene terrain where the virtual character moves, using the functional component after the control parameter optimization, adjust the first character state related to the current gravity of the virtual character to the second character state related to the target gravity.
[0046] It should be noted that the gravity state change instruction can be a change instruction triggered by a change in the virtual environment terrain, or a change instruction triggered by a change in the motion state of the virtual character. The change in gravity state can be a change in the direction of gravity and / or a change in the magnitude of gravity. Among them, the change in the terrain of the virtual environment can be understood as a change from a ground plane to a vertical wall, from a ground plane to a cliff, from a ground plane to a curved surface, and other terrain scenes. There can be many changes in the motion state of the virtual character, including but not limited to: translation state, falling state, jumping state, rotation state, etc. Furthermore, the corresponding target gravity state can be detected according to the motion state, which is specifically illustrated in the following embodiments.
[0047] There are many functional components affected by gravity, such as skill components (that is, functional components related to skill display effects), clothing effect components, combat components, mobile components (functional components related to the mobile status and mobile effects of virtual characters), etc., all of which are affected by gravity. Whether the corresponding functional components need to be optimized should be selected according to the actual situation. The control parameters of some functional components will be affected by changes in gravity, while others will not be affected by changes in gravity. For example, the virtual character uses game skills to control the freezing of the lake. Since the gravity state of environmental objects in the open world game scene has not changed, that is, the lake is still controlled by environmental gravity, it is reasonable. Therefore, the functional component that implements this skill does not need to be optimized. For another example, in the game, the virtual character has changed the gravity state (for example, walking on the vertical plane of the wall). The virtual character uses the fire-breathing skill during the execution of the task. Since the direction of the flame is weakly affected by the original gravity (that is, environmental gravity), the flame effect of the virtual character's fire-breathing is only affected by the target gravity state. Therefore, the functional component of the flame skill effect needs to be optimized.
[0048] Here, the adjustment of the first character state related to the current gravity of the virtual character to the second character state related to the target gravity can be understood as that when the motion state of the virtual character changes, the corresponding gravity state also changes. Furthermore, functional components related to gravity or affected by gravity. Which ones are related to gravity or affected by gravity can be determined by the game player. For example, the game player can choose game characters (astronaut characters) and game scenes (for example, space scenes, moon scenes) with different gravity attributes. After optimizing and modifying the functional components using control parameters, the optimized and modified functional components can be used to adjust the state of the virtual character from the first character state before optimization to the second character state after optimization. The character state mentioned here can be understood as various states related to the character, including but not limited to: clothing, sports, skills, skill effects, etc. So as to meet the diversified adjustment needs of gravity state.
[0049] In practical applications, the effects and degrees of gravity influence on each functional component in different motion states are different. Therefore, when optimizing the parameters of the functional components, the schemes adopted are not completely the same. The optimization process of the control parameters of the functional components of the virtual character in different motion states will be illustrated by specific embodiments.
[0050] In one or more embodiments of the present application, determining the control parameters of the functional components affected by gravity according to the motion state includes: determining the target gravity direction of the virtual character according to the motion state; performing analytical calculations on the movement speed of the virtual character according to the target gravity direction based on the motion state and the virtual scene terrain, to obtain target movement speed control parameters; and / or performing analytical calculations on the character skills of the virtual character according to the target gravity direction based on the motion state and the virtual scene terrain, to obtain target character skill control parameters; and optimizing the functional components corresponding to the motion state using the target motion control parameters and / or target character skill control parameters.
[0051] It should be noted that when determining the target gravity direction according to the motion state, the target gravity direction corresponding to different motion states is determined in different ways. It can be roughly divided into translation state, falling state, jumping state, rotation state, etc. The scheme for determining the target gravity direction will be illustrated in the following embodiments related to the corresponding motion state, and will not be repeated here.
[0052] In the game scene, the most obvious factors affected by gravity include movement speed and character skills. Therefore, when the direction of gravity changes, it is necessary to analyze the movement speed and character skills in the target gravity direction. Of course, in addition to processing the target character skills and target movement speed mentioned above, other contents can also be optimized using the target gravity parameters, such as the costumes, hair, and oaths of the virtual characters.
[0053] In one or more embodiments of the present application, the motion state is a translation state. The motion speed of the virtual character is analytically calculated according to the motion state and the virtual scene terrain according to the target gravity direction to obtain the target motion speed control parameter, including:
[0054] Determine a translation direction vector representing the virtual character in a translation state and a unit vector representing the target gravity direction; project the translation direction vector to the unit vector, and perform a dot product processing on the translation direction vector and the unit vector to obtain the target motion direction.
[0055] In the translation state, the direction of movement of the virtual character is represented by the translation direction vector. This vector is usually determined according to the movement state corresponding to the character's input (such as the direction input of the keyboard, handle or joystick).
[0056] Assume that the translation direction vector is d = (dx, dy, dz), where dx, dy, dz are the components of the vector on the X-axis, Y-axis, and Z-axis, respectively.
[0057] Target gravity direction unit vector:
[0058] The target gravity direction is determined dynamically and may change with the character's position in the virtual scene or changes in game logic.
[0059] Assume that the target gravity direction vector is g = (gx, gy, gz). For the convenience of calculation, it needs to be converted into a unit vector g`.
[0060] By projecting the translation direction vector d onto the unit vector g' in the target gravity direction, the magnitude of the component in the gravity direction can be calculated. This component magnitude represents the "intended" speed of the character in the gravity direction. The dot product d·g' actually gives the projection length of the translation direction vector d on the unit vector g' in the target gravity direction, that is, the "similarity" or "degree of alignment" between the two.
[0061] Here, the target movement direction may not be simply the projected direction (because that will only contain the component in the direction of gravity), but needs to be determined according to the game logic and character behavior. One possible way is to keep the horizontal component of the original translation direction vector d (that is, the component perpendicular to the direction of gravity), and replace the vertical component (that is, the component in the direction of gravity) with the projected component. However, this method may need to be adjusted according to specific game requirements. Another more direct method is to directly replace the translation direction vector d with a vector that is more "aligned" with the direction of gravity after dot product processing, if the game logic allows, but this may change the character's original movement intention.
[0062] In practical applications, the impact of the virtual scene terrain on the movement speed also needs to be considered. For example, on a slope, the actual movement speed of the character may be affected by the slope angle and friction. This can be achieved by adjusting the length of the target movement direction vector (i.e., the speed magnitude) or applying additional acceleration / deceleration.
[0063] The target motion speed control parameters finally obtained (which may be the adjusted speed vector or related speed and acceleration values) will be used to update the motion state of the virtual character to achieve a more realistic and physically compliant motion effect.
[0064] For ease of understanding, the process of determining target gravity in the translation state is described below in detail through a specific embodiment.
[0065] like Figure 2 This is a schematic diagram of a moving target gravity detection ray for illustrating an embodiment of the present application. Figure 2 As can be seen in the figure, suppose that in the virtual scene of the current game, there is a virtual character ( Figure 2 When the virtual character (the capsule represents the character) walks or runs, a ray is emitted from a certain distance above the character's capsule (above the character refers to a certain distance in the opposite direction of the character's current gravity) in the direction of the character's current moving speed, which is the target gravity detection ray. Since the motion state of the virtual character is a translation state, when constructing the target gravity detection ray, the target gravity detection ray is constructed along the tangent direction of the motion trajectory.
[0066] It should be noted that, in a preferred embodiment, when constructing the target gravity detection ray, it is necessary to construct the target gravity detection ray at a certain distance above the capsule body of the virtual character. For example, the target gravity detection ray is constructed at a position 5 centimeters above the virtual character. The upper distance position mentioned here is set according to the actual scene and needs. For another example, if the virtual character is an elf character or a flying saucer character that can float and move without contacting the ground, the target gravity detection ray can be constructed from the center position of the virtual character along the tangent direction of the movement. Of course, in the above-mentioned scenario of constructing the target gravity detection ray for the translation state, the choice of the starting position of the ray can be modified or adjusted according to actual needs, and does not constitute a limitation on the technical solution of the present application. It can be selected or adjusted as needed in actual applications.
[0067] Furthermore, it is assumed that the target gravity detection ray is constructed from a certain distance above the virtual character, and then Figure 2 It can be seen that the target gravity detection ray collides with the wall in front of it, and the collision result can be known. That is, the intersection point of the target gravity detection ray and the wall in front can be known, and the target gravity direction can be determined along the direction of the target gravity detection ray.
[0068] In one or more embodiments of the present application, the motion state is a translation state; the character skills of the virtual character are analyzed and calculated according to the target gravity direction based on the motion state and the virtual scene terrain to obtain the target character skills, including: judging whether the skill display effect of the character skill is affected by the target gravity and / or the environmental gravity; if the judgment result is that the skill display effect is only affected by the target gravity, the character skill is projected to the unit vector, and the skill display effect is corrected according to the target gravity direction and magnitude; if the judgment result is that the skill display effect is affected by the target gravity and the environmental gravity, the character skill is projected to the unit vector, and the skill display and effect are corrected according to the direction and magnitude after the superposition of the target gravity and the environmental gravity; if the judgment result is that the skill display effect is not affected by the target gravity, the skill display effect is realized according to the original skill parameters.
[0069] In actual applications, different target character skills are affected by different types of gravity. As mentioned above, some are only affected by target gravity, or only affected by environmental gravity, or affected by both target gravity and environmental gravity. The details are as follows:
[0070] In a virtual game environment, when a virtual character is in a translation state and is preparing to release a skill, in order to ensure that the performance of the skill conforms to both physical laws and game design, it is necessary to conduct in-depth analytical calculations on the character's skills based on the character's movement state, terrain, and target gravity direction.
[0071] For skills that are affected by both target gravity and environmental gravity, first calculate the direction and magnitude of the combined force of the two gravity forces. Then, project the skill direction vector onto the unit vector of the combined force direction. Adjust the skill display effect based on the combined force direction and magnitude, and more complex physical simulation may be required to ensure the authenticity and accuracy of the skill performance.
[0072] Based on the projection results and gravity direction, the skill display effect is corrected. This may include adjusting the skill's flight trajectory, speed, acceleration, bounce height and other parameters. At the same time, consider the impact of terrain factors on skill effects, such as slopes, steps, swamps, etc., and adjust skill parameters to simulate the impact of these terrains on skill effects. After completing all the above calculations and corrections, the final skill display effect is applied to the game. This includes rendering skill animations, playing sound effects, calculating damage or effects, etc.
[0073] Through the above steps, it can be ensured that the virtual character can accurately analyze and calculate the skill display effect according to the target gravity direction and the terrain when releasing skills, thereby providing a more realistic and physically compliant gaming experience.
[0074] In one or more embodiments of the present application, the motion state is a jumping state and / or a falling state. The motion speed of the virtual character is analytically calculated according to the motion state and the virtual scene terrain according to the target gravity direction to obtain the target motion speed control parameter, including: determining the upward speed of the virtual character when taking off, and the falling speed of the virtual character after taking off; determining the first target gravity direction using the upward speed, and determining the second target gravity direction using the falling speed; projecting the upward speed on the Z axis in the three-dimensional coordinate system according to the first target gravity direction to obtain the target upward speed; and projecting the falling speed on the Z axis in the three-dimensional coordinate system according to the second target gravity direction to obtain the target falling speed.
[0075] In Unreal Engine, when dealing with the jumping and falling states of virtual characters, the PhysFalling method is mainly relied on, but in these two states, the analytical calculation of the movement speed is different, especially the influence of target gravity and environmental gravity needs to be considered. The following is a detailed analytical calculation process:
[0076] When the virtual character starts to jump, an initial upward velocity is applied to the character in the DoJump method. This velocity determines the height and initial kinetic energy of the character's jump. The jump velocity is usually a predefined vector with an upward direction (i.e., the positive direction of the Z axis) and a magnitude determined by factors such as the character's ability and the jump type.
[0077] After the character reaches the highest point of the jump, it starts to fall. At this time, its speed gradually increases under the action of gravity, forming a falling speed. The falling speed is a vector, which is downward (i.e., the negative direction of the Z axis) and is calculated based on the gravitational acceleration and time (starting from the highest point of the jump).
[0078] Assuming that the gravity during the take-off phase is the first target gravity, for the upward speed during the take-off, since the character is rising against gravity at this time, the first target gravity direction is the currently set global gravity direction (usually the negative direction of the Z axis). However, in actual calculations, since the character is moving upward, more attention is paid to the obstruction of gravity to the upward speed, which can be achieved by projecting the upward speed to the first target gravity direction (i.e. the positive direction of the Z axis) which is the opposite direction of the gravity direction.
[0079] Assuming that the target gravity in the falling stage is the second target gravity, for the falling speed, the direction of the second target gravity is the direction of the global gravity (negative direction of the Z axis), because the character is falling under the action of gravity at this time.
[0080] The upward velocity on the Z axis in the three-dimensional coordinate system is projected according to the first target gravity direction (actually the opposite direction of the gravity direction, but in order to be consistent with the subsequent falling speed calculation, it is still expressed as the first target gravity direction here). In fact, this projection process is direct in most cases because the upward velocity is mainly on the Z axis.
[0081] However, since gravity is variable and adjustable, if the gravity direction changes in the scene, it is necessary to first determine the gravity direction of the face at the current position and then perform projection. The trajectory and height of the virtual character's jump are calculated based on the target gravity direction.
[0082] The falling speed on the Z axis in the three-dimensional coordinate system is projected according to the second target gravity direction (i.e., the global gravity direction, the negative direction of the Z axis). Since the falling speed itself is generated under the action of gravity and is usually mainly along the negative direction of the Z axis, the projection process is relatively simple. The target falling speed obtained after projection will be used to calculate the acceleration, speed, and position of the character's fall, ensuring that the character's falling behavior in the virtual scene conforms to the laws of physics.
[0083] Through the above embodiments, the movement speed can be analytically calculated according to the movement state of the virtual character (jumping and / or falling) and the terrain of the virtual scene in which it is located, and optimized target movement speed parameters can be obtained, thereby improving the accuracy of the character's movement performance in a dynamic gravity environment.
[0084] For ease of understanding, the following example illustrates how to determine the target gravity direction in a falling state. Figure 3a A schematic diagram of a falling target gravity detection ray provided in an embodiment of the present application. Figure 3a As can be seen in the figure, the virtual character capsule (that is, the side view of the character) is the way to fall after jumping. At the starting position of the jump, there is an oblique upward speed. At this time, the direction of the target gravity detection ray is consistent with the speed of the virtual character or the tangent direction of the motion trajectory. As the horizontal speed decays, the speed direction and motion trajectory of the virtual character also change accordingly, and the direction of the target gravity detection ray on the tangent direction of the corresponding motion trajectory is also adjusted accordingly. However, before the gravity changes (that is, before the target gravity detection ray collides with the surrounding terrain environment), the gravity direction is always downward. It can be seen that in the case of jumping and falling, the process of constructing the target gravity detection ray is more complicated and will change accordingly with the change of the motion trajectory. In this case, there are also multiple possibilities for the collision result. For example, in the oblique upward stage of jumping, the target gravity detection ray collides with the oblique upper object, and a collision result will be generated on the oblique upper object. Then, the second target gravity state and the falling point are determined based on the collision result of this position. If no collision occurs in the jumping and rising stage, the virtual character will fall downward next, and the target gravity detection ray will be constructed in the same way to determine the collision result.
[0085] In one or more embodiments of the present application, when the motion state is a jumping state and / or a falling state, the character skill of the virtual character is analyzed and calculated according to the target gravity direction based on the motion state and the virtual scene terrain to obtain the target character skill control parameter, including:
[0086] Determine whether the skill display effect of the character skill is affected by the first target gravity and the second target gravity, and / or environmental gravity;
[0087] If the judgment result is that the skill display effect is only affected by the first target gravity and the second target gravity, the character skill is projected onto the unit vectors corresponding to the first target gravity and the second target gravity respectively, and the skill display effect is corrected according to the direction and magnitude of the first target gravity and the second target gravity respectively;
[0088] If the judgment result is that the skill display effect is affected by the first target gravity, the second target gravity and the environmental gravity, the character skill is projected onto the unit vectors corresponding to the first target gravity and the second target gravity respectively, and the skill display and effect are corrected according to the direction and magnitude after the first target gravity, the second target gravity and the environmental gravity are superimposed;
[0089] If the judgment result is that the skill display effect is not affected by the target gravity, the skill display effect is achieved according to the original skill parameters.
[0090] In actual applications, the character skills of the virtual character will also be adjusted accordingly when the gravity state is adjusted. Of course, the specific adjustment needs to be differentiated according to the skill type. That is, some skills are only affected by the first target gravity and the second target gravity. That is, when falling or jumping, the character skills are adjusted accordingly according to the second target gravity and the first target gravity.
[0091] If the character's skills are affected by the first target gravity, the second target gravity and the environment gravity at the same time, the three gravity will be used to adjust the character's skills. For specific ways to adjust the character's skills, please refer to the translation state and Figure 3a The corresponding embodiments will not be repeated here.
[0092] Apart from Figure 2 and Figure 3a In addition to the target gravity direction determination scheme shown, there are other determination methods, which will be illustrated below through specific embodiments.
[0093] Figure 3b A schematic diagram of another target gravity detection ray array provided in an embodiment of the present application. Figure 3a In addition to the current speed direction detection described in the previous section, the virtual character's current horizontal plane (perpendicular to the virtual character's current gravity and passing through the center of the virtual character (that is, Figure 3b A week of X-ray testing was performed on the center of the capsule body of the virtual character (i.e. Figure 3b When the character in the virtual character falls, it searches for the surrounding landing plane. If multiple rays detect suitable planes, the closest plane is selected. In this way, the preferred collision plane in the surrounding virtual environment can be quickly selected by using a circle of detection rays built based on the center of the virtual character.
[0094] In practical applications, game technicians can choose to use Figure 3a The scheme shown Figure 3b The solution shown can better meet the diverse needs of game technicians.
[0095] In the falling state, the collision result between the target gravity detection ray and the virtual scene terrain is calculated according to a preset collision detection algorithm, and the target gravity state and falling point of the virtual character are determined according to the collision result, including: after constructing the target gravity detection ray, obtaining the collision result between the target gravity detection ray and the virtual scene terrain; the collision result includes a collision intersection point and a tangent line of the motion trajectory at the collision intersection point. The collision intersection point in the collision result is used as the falling point, and the normal direction of the plane where the falling point is located is used as the target gravity direction.
[0096] In practical applications, the calculation of the collision result between the target gravity detection ray and the virtual scene terrain according to the preset collision detection algorithm, and then determining the target gravity state and falling point of the virtual character according to these collision results, specifically includes the following steps:
[0097] Construct target gravity detection rays: Construct one or more target gravity detection rays at the current position of the virtual character or at a point determined according to a specific motion state (such as the virtual character's jumping, falling, etc.). These rays usually extend along the direction of gravity (or possible directions, such as the anti-gravity direction when jumping upwards) to detect potential collisions with the virtual scene terrain.
[0098] The collision between the target gravity detection ray and the virtual scene terrain is calculated using a preset collision detection algorithm. The collision detection algorithm can be a four-probe algorithm, or it can be implemented based on space partitioning (such as octree, quadtree), bounding volume hierarchy (BVH), distance field or ray tracing.
[0099] After the collision detection is completed, the collision results are obtained. These results usually include: Collision intersection point: the specific point where the target gravity detection ray intersects with the virtual scene terrain, which will be used as the virtual character's falling point. The collision intersection point in the collision result is directly designated as the virtual character's falling point. This means that the virtual character will physically contact the terrain at this point and may change its motion state as a result.
[0100] After determining the fall point, it is necessary to estimate the normal direction of the plane at that point as the target gravity direction. This usually involves analyzing the local geometry of the terrain. In some cases, the normal of the terrain grid at that point can be used directly; in more complex terrain, it may be necessary to estimate it through methods such as interpolation or surface fitting.
[0101] According to the estimated target gravity direction, combined with the current motion state of the virtual character (such as speed, acceleration, rotation, etc.), the new gravity state is calculated and applied. This may include adjusting the character's falling speed, rotation angle, and triggering related physical effects (such as bouncing, sliding, etc.).
[0102] Through the above steps, a relatively accurate and dynamic detection and calculation scheme for the falling point and target gravity state can be implemented, providing a more realistic and natural experience for the movement and interaction of virtual characters in complex virtual scenes.
[0103] Among them, this application also proposes an optimal solution for calculating target gravity. Figure 4 A schematic diagram of a four-probe calculation scheme proposed in the embodiment of the present application. Figure 4As can be seen in the figure, a scheme for determining the target gravity direction using four probes is used. A four-probe ray matrix is constructed at the intersection position; the intersection of any ray in the four-probe ray matrix and the surrounding objects is determined; the first vector and the second vector are constructed in the vertical direction and the horizontal direction respectively with the intersection as the starting point; the target normal is determined based on the dot product operation result of the first vector and the second vector; the target gravity matching the current motion state of the virtual character is calculated using the target normal.
[0104] Specifically, a four-probe ray lattice is constructed: at the collision intersection (i.e., the falling point), four equidistant and mutually perpendicular rays are constructed to form a cross or square probe ray lattice. These rays should be long enough to ensure that they can intersect with the terrain or obstacles in the virtual scene.
[0105] For each probe ray, calculate its collision intersection with the virtual scene terrain. These collision intersections will be used for subsequent calculations. Take each collision intersection as the starting point and construct two vectors: one vertically upward (or other vertical directions defined by the scene) as the first vector; the other is along the tangent direction of the terrain surface (an approximation of the horizontal direction) as the second vector. Note that the tangent direction here may need to be estimated based on the local terrain information at the collision point.
[0106] The dot product operation is performed on the first vector and the second vector of each collision intersection. Since the sign of the dot product can represent the angle between the two vectors (positive when the angle between the two vectors is less than 90 degrees and negative when it is greater than 90 degrees), the local curvature or tilt direction of the terrain can be inferred by analyzing the signs of these dot products.
[0107] By combining the information of all collision intersections, a more accurate target normal direction can be estimated through weighted average or other statistical methods. This direction will be used as the target gravity direction. Based on the calculated target normal direction and the current motion state of the virtual character (such as speed, acceleration, etc.), the corresponding target gravity is calculated and applied to achieve more realistic physical effects and dynamic reactions.
[0108] Of course, in addition to the four-probe solution, calculations can also be performed based on the size of the contact area. For example, the contact area can be detected first, that is, when a collision occurs, the contact area between the virtual character and the virtual scene terrain is detected. This usually involves polygon or mesh collision processing in the collision detection algorithm. According to the shape and size of the contact area, the contact area is calculated. This may require the use of area calculation formulas for geometric figures, such as the area formulas for triangles, rectangles, or polygons. Based on the geometric characteristics and distribution of the contact area, an average normal direction is estimated. This can be achieved by weighted averaging the normals of the boundary points of the contact area, or by using more complex surface reconstruction techniques to estimate. Similar to the four-probe solution, based on the estimated target normal direction, combined with the current state of the virtual character, the corresponding target gravity is calculated and applied. This solution based on the size of the contact area may be more suitable for complex terrain or large-area contact situations, and can provide a smoother and more natural gravity transition effect.
[0109] Through the above method, in the falling state, the corresponding target gravity detection ray is constructed according to the specific falling mode (jumping fall or free fall fall). Then, the collision result of the target gravity detection ray is used to determine the falling point and the corresponding target gravity direction, which can be adjusted in real time according to the change of the virtual character's motion state.
[0110] In one or more embodiments of the present application, the method of obtaining the motion state of a virtual character in a virtual scene and determining the type of target gravity detection rays according to the motion state also includes: if the terrain of the virtual scene is a rugged surface, arranging the target gravity detection rays horizontally and vertically with the virtual character as the center, and constructing a target gravity detection ray dot matrix from multiple target gravity detection rays; calculating a set of collision results between the target gravity detection ray dot matrix and the virtual scene terrain according to a preset collision detection algorithm, and determining the target gravity state of the virtual character according to a combination of the collision results and preset result screening conditions.
[0111] like Figure 5a , 5b 5c is a schematic diagram of a target gravity detection ray array provided in an embodiment of the present application. Figure 5a As can be seen in , the normals of each plane in the discontinuous plane can be determined first; then the angle between the current gravity line of the virtual character and the multiple normals can be determined; the multiple normals can be screened according to the angle. The normals obtained by screening are weighted averaged to obtain the weight value of each normal; when there are multiple intersections between the target gravity detection ray and the rugged surface in the target gravity detection ray lattice, the target surface in the rugged surface for calculating the target gravity is selected according to the weight value, and the target gravity is calculated based on the target surface.
[0112] Specifically, if Figure 5c As shown, when the virtual character is in a virtual scene of a rugged surface, for example, the rugged surface can be divided into regions and the normal of each rugged surface can be determined. In a virtual scene of a rugged terrain, it is first necessary to identify the various non-continuous planes that make up the terrain (such as steps and slopes of different heights). For each such plane, calculate the normal vector of its surface. This can usually be achieved by analyzing the geometric relationship between the vertex heights and adjacent vertices of the terrain mesh in this area. The normal vector is perpendicular to the plane and points to the outside or top of the terrain.
[0113] Figure 5a 5b represents the top view of the ray lattice, and 5c represents the side view of the ray lattice. Figure 5a and 5b As shown, the position of the virtual character is determined as the center point of ray emission. Starting from the position of the virtual character, multiple rays are evenly distributed in the horizontal direction (left and right sides) to detect terrain changes on the left and right sides of the character. Starting from the position of the virtual character, rays are emitted in the vertical direction (upper and lower sides), especially the rays emitted downward are used to detect the ground conditions under the feet of the virtual character, and the rays emitted upward (if applicable) are used to detect whether there are hanging objects or obstacles above. In addition, rays centered on the virtual character can be added in other directions as needed. Set the length of each ray, the detection interval (that is, the angle or distance between the rays), and the possible penetration (whether to penetrate specific objects (such as leaves, flowers, etc.) to continue detection). The specific collision algorithm can adopt the method described above, which will not be repeated here. Please refer to the various embodiments described above.
[0114] Determine the current direction of the virtual character's gravity line (in most cases, this is the direction perpendicular to the ground plane of the virtual scene). Then, calculate the angle between this gravity line and each plane normal determined previously. The size of the angle reflects the degree of deviation between the gravity direction and the plane normal direction.
[0115] Multiple normals are screened based on the size of the angle. Generally speaking, the smaller the angle, the closer the normal direction of the plane is to the direction of gravity, so the plane is more likely to be the main source of gravity currently exerted on the virtual character. A threshold can be set to remove large angles or only keep normals with angles less than the threshold for subsequent processing.
[0116] For the normals obtained by screening, weighted averaging is performed to determine their combined influence on the target gravity. The weight distribution can be based on multiple factors, such as the angle size (the smaller the angle, the greater the weight), the plane area (the larger the area, the greater the possible influence), the distance between the virtual character and the plane (the closer the distance, the more direct the influence), etc. Through weighted averaging, the contribution of each normal in determining the target gravity direction can be calculated.
[0117] In the target gravity detection ray matrix, if there are multiple intersection points, that is, the target gravity detection ray of the virtual character intersects with the rugged surface at multiple locations, then the target surface needs to be selected based on the weight value calculated previously. The target surface is one of those planes with the highest weight value and the greatest impact on the direction of gravity. Once the target surface is determined, the target gravity can be calculated based on the normal direction of the surface. This usually means adjusting the gravity direction to be consistent with the normal direction of the target surface (or fine-tuning it according to the weight) to ensure that the behavior of the virtual character on the rugged surface is more realistic and in line with the laws of physics. Through the above steps, the target gravity state of the virtual character in the rugged terrain can be determined more accurately, providing a more realistic and immersive gaming experience.
[0118] In one or more embodiments of the present application, the motion state is a rotation state; the motion speed of the virtual character is analytically calculated according to the motion state and the virtual scene terrain according to the target gravity direction to obtain the target motion speed control parameter, including: determining the rotation angle size representing the rotation state of the virtual character, and the unit vector of the target gravity direction that dynamically changes corresponding to each rotation angle;
[0119] The rotation direction vector is projected onto the unit vector, and the dot product of the rotation direction vector and the unit vector is processed to obtain the target motion direction that changes dynamically with the rotation state of the virtual character.
[0120] In actual applications, if the virtual character is in a state of rotational movement, or the terrain of the virtual scene where the virtual character is located is in a state of rotational movement relative to the virtual character, it is necessary to further determine the size of the rotation angle of the rotational movement. If the rotation angle is not large (for example, the rotation angle is less than the angle threshold), the target gravity state of the virtual character can be directly adjusted. Since the angle deviation is not large, direct adjustment will not make the user feel that the gravity direction jumps and changes.
[0121] On the contrary, if the rotation angle is greater than the angle threshold, the target gravity state needs to be gradually adjusted by interpolation, that is, the gravity direction is adjusted step by step. Through the above scheme, when determining the target gravity direction, corresponding adjustments are made according to the rotation angle, so that the adjustment process is more natural and the game users get a better gaming experience.
[0122] In the rotating state, the character's skills also need to be adjusted synchronously with the target gravity direction. Specifically, first determine whether the skill display effect of the character's skills is affected by the target gravity and / or the environmental gravity;
[0123] If the result of the judgment is that the skill display effect is only affected by the target gravity, the character skill is projected onto the unit vector that changes dynamically with the rotation state of the virtual character, and the skill display effect is corrected according to the direction and magnitude of the target gravity;
[0124] If the result of the judgment is that the skill display effect is affected by the target gravity and the environmental gravity, the character skill is projected onto the unit vector that changes dynamically with the rotation state of the virtual character, and the skill display and effect are corrected according to the direction and magnitude after the superposition of the target gravity and the environmental gravity;
[0125] If the judgment result is that the skill display effect is not affected by the target gravity, the skill display effect is achieved according to the original skill parameters.
[0126] In actual applications, the character skills of the virtual character will also be adjusted accordingly when the gravity state is adjusted. Of course, the specific adjustment needs to be differentiated according to the skill type. That is, some skills are only affected by the target gravity, that is, when in the rotating state, the character skills are adjusted accordingly according to the target gravity.
[0127] If the character's skills are affected by both target gravity and environmental gravity, the two gravity factors will be used to adjust the character's skills. For details on how to adjust the character's skills, see Rotation State and Figure 4 The corresponding embodiments will not be repeated here.
[0128] In one or more embodiments of the present application, it also includes: when the virtual character is in a falling state, obtaining the current falling position of the virtual character; determining the actual falling distance according to the falling starting position and the current falling position; if the actual falling distance reaches a preset falling threshold, restoring the target gravity of the virtual character in the falling direction, eliminating the horizontal speed of the virtual character, and determining the restored target movement and target skill along the direction of the environmental gravity.
[0129] like Figure 6 This is a schematic diagram of the actual falling distance provided in the embodiment of the present application. Figure 6 As can be seen in the figure, during the falling process of the virtual character, the gravity state needs to be controlled according to the actual falling distance. If the gravity state is not controlled or restricted, when the falling distance is long enough, the virtual character will appear in a flying state, which is obviously inconsistent with the actual situation (not consistent with the movement state affected by gravity in the open world). Therefore, the gravity state needs to be adjusted accordingly according to the change of the actual falling distance.
[0130] The actual falling distance here refers to the distance from the starting position to the current falling position. During the falling process of the virtual character, the current falling position is constantly changing. When the actual falling distance reaches the preset distance threshold, the target gravity state of the virtual character will be restored. That is, the target gravity state of the virtual character in the falling direction will be restored. When the target gravity is restored, the horizontal speed of the virtual character will also be eliminated to avoid the effect of the virtual character flying forward continuously.
[0131] Based on the same idea, a virtual character variable gravity adjustment device is also proposed. Figure 7 This is a schematic diagram of the structure of a virtual character variable gravity adjustment device provided in an embodiment of the present application. Figure 7 The device comprises:
[0132] The acquisition module 71 is used to acquire the motion state of the virtual character in the virtual scene in response to the virtual character gravity state change instruction.
[0133] The determination module 72 is used to determine the control parameters of the functional components affected by gravity according to the motion state, and the functional components include one or more of the movement components for controlling the movement of the virtual character and the skill components for controlling the release of the skills of the virtual character.
[0134] The adjustment module 73 is used to adjust the first character state related to the current gravity of the virtual character to the second character state related to the target gravity by using the functional component after the control parameter optimization on the virtual scene terrain where the virtual character moves.
[0135] A determination module 72, configured to determine a target gravity direction of the virtual character according to the motion state;
[0136] According to the motion state and the virtual scene terrain, the motion speed of the virtual character is analytically calculated according to the target gravity direction to obtain a target motion speed control parameter; and / or,
[0137] Analytically calculating the character skill of the virtual character according to the target gravity direction according to the motion state and the terrain of the virtual scene, and obtaining the target character skill control parameter;
[0138] The target motion speed control parameters and / or target character skill control parameters are used to optimize the functional components corresponding to the motion state.
[0139] Optionally, the motion state is a translation state.
[0140] A determination module 72, used to determine a translation direction vector representing the virtual character in a translation state, and a unit vector representing the target gravity direction;
[0141] The translation direction vector is projected onto the unit vector, and the dot product of the translation direction vector and the unit is processed to obtain the target motion direction.
[0142] Optionally, the motion state is a translation state.
[0143] A determination module 72, used to determine whether the skill display effect of the character skill is affected by target gravity and / or environmental gravity;
[0144] If the judgment result is that the skill display effect is only affected by the target gravity, projecting the character skill to the unit vector, and modifying the skill display effect according to the direction and magnitude of the target gravity;
[0145] If the result of the judgment is that the skill display effect is affected by the target gravity and the environmental gravity, the character skill is projected onto the unit vector, and the skill display and effect are corrected according to the direction and magnitude of the superposition of the target gravity and the environmental gravity;
[0146] If the judgment result is that the skill display effect is not affected by the target gravity, the skill display effect is achieved according to the original skill parameters.
[0147] Optionally, the motion state is a jumping state and / or a falling state;
[0148] A determination module 72, used to determine the upward speed of the virtual character when jumping, and the falling speed of the virtual character after jumping;
[0149] determining a first target gravity direction using the upward velocity, and determining a second target gravity direction using the falling velocity;
[0150] Projecting the upward velocity on the Z axis in the three-dimensional coordinate system according to the first target gravity direction to obtain a target upward velocity; and
[0151] The falling speed on the Z axis in the three-dimensional coordinate system is projected according to the second target gravity direction to obtain a target falling speed.
[0152] Optionally, the motion state is a jumping state and / or a falling state;
[0153] A determination module 72, used to determine whether the skill display effect of the character skill is affected by the first target gravity and the second target gravity, and / or the environmental gravity;
[0154] If the judgment result is that the skill display effect is only affected by the first target gravity and the second target gravity, the character skill is projected onto the unit vectors corresponding to the first target gravity and the second target gravity respectively, and the skill display effect is corrected according to the direction and magnitude of the first target gravity and the second target gravity respectively;
[0155] If the judgment result is that the skill display effect is affected by the first target gravity, the second target gravity and the environmental gravity, the character skill is projected onto the unit vectors corresponding to the first target gravity and the second target gravity respectively, and the skill display and effect are corrected according to the direction and magnitude after the first target gravity, the second target gravity and the environmental gravity are superimposed;
[0156] If the judgment result is that the skill display effect is not affected by the target gravity, the skill display effect is achieved according to the original skill parameters.
[0157] Optionally, the motion state is a rotation state.
[0158] A determination module 72, used to determine the rotation angle of the virtual character in the rotation state, and the unit vector of the target gravity direction that changes dynamically corresponding to each rotation angle;
[0159] The rotation direction vector is projected onto the unit vector, and the dot product of the rotation direction vector and the unit vector is processed to obtain the target motion direction that changes dynamically with the rotation state of the virtual character.
[0160] Optionally, the motion state is a rotation state.
[0161] A determination module 72, used to determine whether the skill display effect of the character skill is affected by target gravity and / or environmental gravity;
[0162] If the result of the judgment is that the skill display effect is only affected by the target gravity, the character skill is projected onto the unit vector that changes dynamically with the rotation state of the virtual character, and the skill display effect is corrected according to the direction and magnitude of the target gravity;
[0163] If the result of the judgment is that the skill display effect is affected by the target gravity and the environmental gravity, the character skill is projected onto the unit vector that changes dynamically with the rotation state of the virtual character, and the skill display and effect are corrected according to the direction and magnitude after the superposition of the target gravity and the environmental gravity;
[0164] If the judgment result is that the skill display effect is not affected by the target gravity, the skill display effect is achieved according to the original skill parameters.
[0165] A determination module 72, configured to obtain a current falling position of the virtual character when the virtual character is in a falling state;
[0166] Determining an actual falling distance according to the falling starting position and the current falling position;
[0167] If the actual falling distance reaches a preset falling threshold, the target gravity of the virtual character in the falling direction is restored, the horizontal speed of the virtual character is eliminated, and the restored target movement and target skill along the direction of the environmental gravity are determined.
[0168] It should be noted that the functional units contained in the various modules mentioned in the foregoing text can realize the various functions described in the foregoing intelligent dialogue system, and will not be repeated here.
[0169] In one possible design, the above Figure 8 The structure of the intelligent dialogue device shown can be implemented as an electronic device. Figure 8 As shown, the electronic device may include: a processor 81 and a memory 82. The memory 82 stores executable code, and when the executable code is executed by the processor 81, the processor 81 can at least implement the lip animation generation method provided in the above embodiment. The structure of the electronic device may also include a communication interface 83 for communicating with other devices or communication networks.
[0170] In addition, an embodiment of the present invention provides a non-transitory machine-readable storage medium, on which executable code is stored. When the executable code is executed by a processor in a server or a computer, the processor executes the operations provided in the above embodiments. Figure 1 The corresponding method.
[0171] The device embodiments described above are merely illustrative, wherein the modules described as separate components may or may not be physically separated. Some or all of the modules may be selected according to actual needs to achieve the purpose of the present embodiment. Those of ordinary skill in the art may understand and implement the present invention without creative effort.
[0172] Through the description of the above embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by adding a necessary general hardware platform, and of course can also be implemented by combining hardware and software. Based on such an understanding, the above technical solution can essentially or contribute to the part in the form of a computer product, and the present invention can be implemented in the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) including computer-usable program codes.
[0173] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A method for adjusting variable gravity of a virtual character, characterized in that: The method comprises: In response to the virtual character gravity state change instruction, obtaining the motion state of the virtual character in the virtual scene; Determining control parameters of functional components affected by gravity according to the motion state, wherein the functional components include one or more of a movement component for controlling movement of the virtual character and a skill component for controlling release of skills of the virtual character; On the virtual scene terrain where the virtual character moves, the first character state related to the current gravity of the virtual character is adjusted to a second character state related to the target gravity by using the functional component after the control parameter optimization.
2. The method according to claim 1, characterized in that Determining the control parameters of the functional components affected by gravity according to the motion state includes: Determining a target gravity direction of the virtual character according to the motion state; According to the motion state and the virtual scene terrain, the motion speed of the virtual character is analytically calculated according to the target gravity direction to obtain a target motion speed control parameter; and / or, Analytically calculating the character skill of the virtual character according to the target gravity direction according to the motion state and the terrain of the virtual scene, and obtaining the target character skill control parameter; The target motion speed control parameters and / or target character skill control parameters are used to optimize the functional components corresponding to the motion state.
3. The method according to claim 2, characterized in that The motion state is a translation state; The step of performing analytical calculation on the movement speed of the virtual character according to the movement state and the virtual scene terrain according to the target gravity direction to obtain the target movement speed control parameter includes: Determine a translation direction vector representing the virtual character in a translation state, and a unit vector representing the target gravity direction; The translation direction vector is projected onto the unit vector, and the dot product of the translation direction vector and the unit is processed to obtain the target motion direction.
4. The method according to claim 3, characterized in that The motion state is a translation state; The step of performing analytical calculation on the character skill of the virtual character according to the motion state and the virtual scene terrain in accordance with the target gravity direction to obtain the target character skill includes: Determine whether the skill display effect of the character skill is affected by target gravity and / or environmental gravity; If the judgment result is that the skill display effect is only affected by the target gravity, projecting the character skill to the unit vector, and modifying the skill display effect according to the direction and magnitude of the target gravity; If the judgment result is that the skill display effect is affected by the target gravity and the environmental gravity, the character skill is projected onto the unit vector, and the skill display and effect are corrected according to the direction and magnitude of the superposition of the target gravity and the environmental gravity; If the judgment result is that the skill display effect is not affected by the target gravity, the skill display effect is achieved according to the original skill parameters.
5. The method according to claim 1, characterized in that The motion state is a jumping state and / or a falling state; The step of performing analytical calculation on the movement speed of the virtual character according to the movement state and the virtual scene terrain according to the target gravity direction to obtain the target movement speed control parameter includes: Determining an upward speed of the virtual character when jumping, and a falling speed of the virtual character after jumping; determining a first target gravity direction using the upward velocity, and determining a second target gravity direction using the falling velocity; Projecting the upward velocity on the Z axis in the three-dimensional coordinate system according to the first target gravity direction to obtain a target upward velocity; and The falling speed on the Z axis in the three-dimensional coordinate system is projected according to the second target gravity direction to obtain a target falling speed.
6. The method according to claim 5, characterized in that The motion state is a jumping state and / or a falling state; The step of performing analytical calculation on the character skill of the virtual character according to the motion state and the virtual scene terrain in accordance with the target gravity direction to obtain the target character skill control parameter includes: Determine whether the skill display effect of the character skill is affected by the first target gravity and the second target gravity, and / or environmental gravity; If the judgment result is that the skill display effect is only affected by the first target gravity and the second target gravity, the character skill is projected onto the unit vectors corresponding to the first target gravity and the second target gravity respectively, and the skill display effect is corrected according to the direction and magnitude of the first target gravity and the second target gravity respectively; If the judgment result is that the skill display effect is affected by the first target gravity, the second target gravity and the environmental gravity, the character skill is projected onto the unit vectors corresponding to the first target gravity and the second target gravity respectively, and the skill display and effect are corrected according to the direction and magnitude after the first target gravity, the second target gravity and the environmental gravity are superimposed; If the judgment result is that the skill display effect is not affected by the target gravity, the skill display effect is achieved according to the original skill parameters.
7. The method according to claim 1, characterized in that The motion state is a rotation state; The step of performing analytical calculation on the movement speed of the virtual character according to the movement state and the virtual scene terrain according to the target gravity direction to obtain the target movement speed control parameter includes: Determine the rotation angle of the virtual character in the rotation state, and the unit vector of the target gravity direction that changes dynamically corresponding to each rotation angle; The rotation direction vector is projected onto the unit vector, and the dot product of the rotation direction vector and the unit vector is processed to obtain the target motion direction that changes dynamically with the rotation state of the virtual character.
8. The method according to claim 7, characterized in that The motion state is a rotation state; The step of performing analytical calculation on the character skill of the virtual character according to the motion state and the virtual scene terrain in accordance with the target gravity direction to obtain the target character skill control parameter includes: Determine whether the skill display effect of the character skill is affected by target gravity and / or environmental gravity; If the result of the judgment is that the skill display effect is only affected by the target gravity, the character skill is projected onto the unit vector that changes dynamically with the rotation state of the virtual character, and the skill display effect is corrected according to the direction and magnitude of the target gravity; If the result of the judgment is that the skill display effect is affected by the target gravity and the environmental gravity, the character skill is projected onto the unit vector that changes dynamically with the rotation state of the virtual character, and the skill display and effect are corrected according to the direction and magnitude after the superposition of the target gravity and the environmental gravity; If the judgment result is that the skill display effect is not affected by the target gravity, the skill display effect is achieved according to the original skill parameters.
9. The method according to claim 5, characterized in that Also includes: When the virtual character is in a falling state, obtaining a current falling position of the virtual character; Determining an actual falling distance according to the falling starting position and the current falling position; If the actual falling distance reaches a preset falling threshold, the target gravity of the virtual character in the falling direction is restored, the horizontal speed of the virtual character is eliminated, and the restored target movement and target skill along the direction of the environmental gravity are determined.
10. An electronic device comprising a processor and a memory, wherein the memory stores at least one instruction, at least one program, a code set or an instruction set, and the at least one instruction, at least one program, a code set or an instruction set is loaded and executed by the processor to implement the method according to any one of claims 1 to 9.
11. A computer-readable medium having stored thereon at least one instruction, at least one program, code set or instruction set, wherein the at least one instruction, at least one program, code set or instruction set is loaded and executed by a processor to implement the method according to any one of claims 1 to 9.
Citation Information
Cited By
Motion control method and device, computing equipment, storage medium and program product
CN121490396A
Game gravity effect simulation method, electronic equipment and medium
CN121513454A
Game gravity effect simulation method, electronic device, medium
CN121513454B