Virtual object motion control method and device in virtual scene and computer equipment
By measuring the collision detection point distance of virtual objects in a virtual scene and adjusting motion parameters, the unnatural behavior problem of virtual objects when moving on complex terrain is solved, achieving smoother and more realistic motion control.
Patent Information
- Application Number
- CN202411927177.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-25
- Publication Date
- 2025-04-11
AI Technical Summary
In the prior art, when virtual objects move on complex terrain in virtual scenes, they are prone to unnatural behavior, such as jitter or instantaneous movement, and simplifying the terrain to a plane may lead to visual problems such as object passing through modes, affecting the sense of reality.
By measuring the distance values of multiple collision detection points on the target object in a moving state with respect to the reference surface, the components of the moving parameters of the target object in the target direction are adjusted, thereby achieving smooth motion of the virtual object on complex terrain.
It reduces the sensitivity of virtual objects to terrain changes, avoids unnecessary jitter or instantaneous movement, realizes precise control of the movement of virtual objects, and improves the smoothness of the movement and visual reality.
Smart Images

Figure CN119792931A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present specification relate to the field of Internet technology, and in particular to a method and device for controlling the motion of a virtual object in a virtual scene, and a computer device. Background Art
[0002] With the advancement of Internet technology and computer graphics, the motion control of virtual objects in virtual scenes has evolved from simple path planning to complex and realistic physical interaction simulation with the scene.
[0003] At present, in order to realize the movement of virtual objects on more complex terrains, the physical engine is usually used directly for collision detection and motion processing. A collision volume is set for the virtual object to detect the contact with the reference surface, and the motion processing of the virtual object is completed according to the physical rules; or the non-planar terrain is simplified into a plane during collision detection, so that the virtual object can move along the plane, thereby avoiding complex collision logic.
[0004] However, using the physics engine to directly perform collision detection and motion processing will produce unnatural character behaviors, such as jitter or teleportation, when moving on uneven terrain; while simplifying complex terrain into a plane, although it simplifies the calculation process, it is easy to cause visual problems such as object penetration, affecting visual realism. Therefore, a more realistic target object motion control method is urgently needed. Summary of the invention
[0005] In view of this, an embodiment of the present specification provides a method for controlling the motion of a virtual object in a virtual scene. One or more embodiments of the present specification also relate to a method for controlling the motion of a humanoid object in a virtual scene, a device for controlling the motion of a virtual object in a virtual scene, a device for controlling the motion of a humanoid object in a virtual scene, a computing device, a computer-readable storage medium, and a computer program product to solve the technical defects existing in the prior art.
[0006] According to one embodiment of the present specification, a method for controlling motion of a virtual object in a virtual scene is provided, comprising: Measuring the distance values of multiple collision detection points on the target object in motion relative to the reference surface; According to the distance values of the plurality of collision detection points relative to the reference surface, adjusting the component of the motion parameter of the target object in the target direction, wherein the target direction is the direction of the target object relative to the reference surface; The target object is controlled to move according to the adjusted motion parameters.
[0007] An embodiment of the present specification implements an object motion control method, comprising: measuring distance values of multiple collision detection points on a target object in motion relative to a reference surface; adjusting components of motion parameters of the target object in a target direction according to the distance values of the multiple collision detection points relative to the reference surface, wherein the target direction is the direction of the target object relative to the reference surface; and controlling the target object to move according to the adjusted motion parameters.
[0008] By measuring the distance values of multiple collision detection points on the target object relative to the reference surface in real time, and adjusting the component of the target object's motion parameters in the target direction in real time accordingly, the smooth movement of the virtual object in the target direction when it moves on uneven terrain is simulated, reducing the sensitivity of the virtual object to terrain changes in the target direction, avoiding unnecessary jitter or instantaneous movement of the virtual object when it moves, achieving precise control of the movement of the virtual object, and significantly improving the smoothness of the movement of the virtual object on complex terrain. At the same time, the movement of the virtual object is controlled in real time according to the real terrain structure, avoiding visual problems such as object penetration and improving visual realism. BRIEF DESCRIPTION OF THE DRAWINGS
[0009] Figure 1 It is a schematic diagram of a method for controlling the motion of a virtual object in a virtual scene in the prior art; Figure 2 is a flow chart of a method for controlling motion of a virtual object in a virtual scene provided by one embodiment of the present specification; Figure 3 It is a schematic diagram of the distance value from the collision detection point to the reference surface included in a method for controlling a virtual object in a virtual scene provided by an embodiment of the present specification; Figure 4 It is a schematic diagram of adjusting the component of the motion parameter of the target object in the target direction included in a method for controlling a virtual object in a virtual scene provided by an embodiment of the present specification; Figure 5 It is a schematic diagram of a method for measuring distance values of multiple collision detection points relative to a reference surface included in a method for controlling a virtual object in a virtual scene provided by an embodiment of the present specification; Figure 6 It is a schematic diagram of the position of a collision simulation area and a motion buffer area of a target object included in a method for controlling a virtual object in a virtual scene provided by one embodiment of the present specification; Figure 7 It is a schematic diagram of adjusting the component of the motion parameter of the target object in the target direction included in another method for controlling a virtual object in a virtual scene provided by an embodiment of the present specification; Figure 8is a schematic diagram of adjusting a component of a motion parameter of a target object in a target direction included in another method for controlling a virtual object in a virtual scene provided by an embodiment of the present specification; Fig. 9 It is a schematic diagram of a circular dot matrix distribution provided by an embodiment of this specification; Fig.10 It is a schematic diagram of adjusting position parameters of a target object in a stationary state included in a method for controlling a virtual object in a virtual scene provided by an embodiment of the present specification; Fig.11 is a flow chart of a method for controlling motion of a humanoid object in a virtual scene provided by one embodiment of the present specification; Fig.12 It is a schematic diagram of a processing process of a method for controlling motion of a virtual object in a virtual scene provided by an embodiment of the present specification; Fig.13 is a flowchart of a processing process of a method for controlling motion of a virtual object in a virtual scene provided by an embodiment of the present specification; Fig.14 It is a structural schematic diagram of a method for controlling the motion of a humanoid object in a virtual scene provided by an embodiment of the present specification; Fig.15 is a structural schematic diagram of a virtual object motion control device in a virtual scene provided by an embodiment of the present specification; Fig.16 It is a structural schematic diagram of a humanoid object motion control device in a virtual scene provided by an embodiment of the present specification; Fig.17 It is a structural block diagram of a computing device provided by an embodiment of this specification. DETAILED DESCRIPTION
[0010] Many specific details are described in the following description to facilitate a full understanding of this specification. However, this specification can be implemented in many other ways than those described herein, and those skilled in the art can make similar generalizations without violating the connotation of this specification, so this specification is not limited to the specific implementation disclosed below.
[0011] The terms used in one or more embodiments of this specification are only for the purpose of describing specific embodiments, and are not intended to limit one or more embodiments of this specification. The singular forms of "a", "said" and "the" used in one or more embodiments of this specification and the appended claims are also intended to include plural forms, unless the context clearly indicates other meanings. It should also be understood that the term "and / or" used in one or more embodiments of this specification refers to and includes any or all possible combinations of one or more associated listed items.
[0012] It should be understood that although the terms first, second, etc. may be used to describe various information in one or more embodiments of this specification, this information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other. For example, without departing from the scope of one or more embodiments of this specification, the first may also be referred to as the second, and similarly, the second may also be referred to as the first. Depending on the context, the word "if" as used herein may be interpreted as "at the time of" or "when" or "in response to determining".
[0013] In addition, 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, stored data, displayed data, etc.) involved in one or more embodiments of this specification are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with the relevant laws, regulations and standards of the relevant countries and regions, and provide corresponding operation entrances for users to choose to authorize or refuse.
[0014] First, the terms involved in one or more embodiments of this specification are explained.
[0015] Collision Detection Points are specific locations on a virtual object that are used to detect the relative distance or contact between the virtual object and other entities or the environment.
[0016] A reference surface is a predefined plane or curved surface in a virtual environment that serves as the basis for measuring distances and other geometric relationships.
[0017] Capsule Collider is a common 3D collision detection shape, widely used in game development and physical simulation. It consists of two hemispheres and a cylinder that smoothly connects the two hemispheres. The overall shape is similar to a capsule or pill, hence the name "Capsule Collider".
[0018] Inverse Kinematics (IK) is a technology used to calculate joint angles or other parameters so that the end effector can reach a specified position and direction. In a virtual environment, the IK algorithm is used to ensure that the parts of the virtual object can naturally adapt to changes in the terrain.
[0019] At present, in order to realize the movement of virtual objects on more complex terrains, the physical engine is usually used directly for collision detection and motion processing. A collision volume is set for the virtual object to detect the contact with the reference surface, and the motion processing of the virtual object is completed according to the physical rules; or the non-planar terrain is simplified into a plane during collision detection, so that the virtual object can move along the plane, thereby avoiding complex collision logic.
[0020] However, directly performing collision detection and motion processing through the physics engine will produce unnatural character behaviors such as jitter or teleportation when moving on uneven terrain; and simplifying complex terrain into a plane, although it simplifies the calculation process, is likely to cause visual problems such as object penetration, affecting visual realism.
[0021] See also Figure 1 , Figure 1 A schematic diagram of a prior art method for controlling the motion of a virtual object in a virtual scene is shown. Figure 1 As shown in the figure: the virtual object moves along the ground at a speed of V, and collision detection is performed by detecting the ground height to adjust the position of the virtual object. At T=0, the height of the virtual object from the ground is H, and the ground height is 0. At this time, the virtual object moves forward along the ground at a height of H; at T=1, the virtual object encounters a staircase terrain with a height of h. At this time, the height of the virtual object is directly adjusted according to the height h of the staircase terrain, and the height of the virtual object is adjusted to H+h, so that the height of the virtual object from the staircase terrain is still H; at T=2, the virtual object after adjusting the height moves horizontally at a height of H+h along the staircase terrain with a height of h. That is, in this process, the motion trajectory of the virtual object undergoes a sudden change at T=1, and is directly adjusted from the original height to the current height. Its motion process is manifested as jitter, and the position moves instantly, causing unnatural behavior of the virtual object and affecting the visual realism.
[0022] In view of the above problems, in this specification, a method for controlling the motion of a virtual object in a virtual scene is provided. One or more embodiments of this specification also relate to a method for controlling the motion of a humanoid object in a virtual scene, a device for controlling the motion of a virtual object in a virtual scene, a device for controlling the motion of a humanoid object in a virtual scene, a computing device, a computer-readable storage medium, and a computer program product, which are described in detail one by one in the following embodiments.
[0023] See also Figure 2 , Figure 2 A flowchart of a method for controlling motion of a virtual object in a virtual scene provided according to an embodiment of the present specification is shown, which specifically includes the following steps.
[0024] Step 202: measuring distance values of a plurality of collision detection points on a target object in motion relative to a reference surface; The embodiments of this specification are applied to applications, websites or applets with image rendering functions, including but not limited to: Unity development engine, 3DS Max development engine, Unreal Engine development engine, Maya development engine, Blender development engine, Three.js library, Babylon.js development engine and A-Frame framework, etc. The execution subjects of the embodiments of this specification include computer devices, mobile smart devices, embedded systems, etc. The embodiments of this specification do not make specific limitations on this.
[0025] Virtual scenes are three-dimensional digital environments created by computer graphics, virtual reality (VR), augmented reality (AR) and other related technologies. Virtual scenes can be divided into many types according to their application fields, such as virtual game scenes in game development, virtual building scenes in architectural design and engineering, virtual driving scenes in education and training, virtual experimental scenes in scientific research, etc.
[0026] Virtual objects are all entities in virtual scenes that are generated by computers and exist in these digital environments. Virtual objects can interact with other entities in virtual scenes or the virtual scenes themselves, and virtual objects can move and change according to preset program logic. For example, in virtual game scenes, virtual objects can include characters, animals, props, etc.; in virtual building scenes, virtual objects can be building structural units, landscape composition units, etc.; in virtual driving scenes, virtual objects can be vehicles, ships, airplanes, etc.; in virtual experimental scenes, virtual objects can be gases, molecules, etc.
[0027] The target object is a virtual object in the virtual scene that needs to be motion controlled.
[0028] Collision detection points are specific locations on a virtual object that are used to detect the relative distance or contact between the virtual object and other entities or environments. Collision detection points are usually distributed at some key parts of the virtual object or specific parts specified by humans, such as the soles of the feet, hands, and head of a humanoid character in a virtual game scene; or the tires and bumpers of a vehicle in a virtual driving scene, and the wings and landing gear of an airplane. Through collision detection points, the system can determine whether the virtual object is close to or in contact with other entities or environments.
[0029] The reference surface is a surface in the virtual scene that determines the position information of the target object relative to the terrain when the target object is controlled in motion. The reference surface can be any type of plane or curved surface, such as a flat ground plane, an uneven ramp, stairs, walls, the surface of other objects, etc. By performing collision detection through the reference surface, the system can accurately calculate the position information of the virtual object relative to the terrain or other objects in the virtual environment. The reference surface can be a static reference surface, such as the ground, stairs, walls, etc., or a dynamic reference surface, such as the sea surface, the surface of a conveyor belt, etc.
[0030] For example, in a scene where a humanoid object moves in a virtual game environment, the humanoid object walks from the horizontal ground to a slope, walks a certain distance on the slope, and then continues walking along the stairs connected to the slope. In this process, the horizontal ground, the slope, and the surfaces of the steps of the stairs together constitute the reference surface for collision detection of the humanoid object.
[0031] That is, the selection of the reference surface may not be determined by any single terrain or object surface, but may be determined jointly by all surfaces on which collision detection is performed during the movement of the target object.
[0032] A target object in motion refers to a virtual object that is in a dynamic state such as moving, rotating or deforming in a virtual scene. A target object in motion has motion parameters, which may include the position, velocity, acceleration and other parameters of the target object. The motion parameters are used to describe and control the motion of the target object.
[0033] The distance value is the distance between the collision detection point and the reference surface, and is used to measure the positional relationship between the target object and the reference surface. The distance value can be measured by a variety of methods, for example, it can be obtained by direct measurement methods, such as ray casting method, grid measurement method, etc.; it can also be obtained by indirect measurement methods, such as by setting a virtual collision detection part of a preset size; it can also be obtained by obtaining coordinate parameters in the virtual environment, directly reading the coordinates of the target object and the reference surface for calculation. The embodiments of this specification do not make specific limitations on this.
[0034] Measure the distance values of multiple collision detection points on a target object in motion relative to a reference surface. Since the target object is in motion, the measurement of the distance value can be a continuous process. Specifically, a certain time interval can be set for measurement, such as performing a measurement once in each frame, or it can be set according to actual needs. The embodiments of this specification do not make specific limitations on this.
[0035] For example, take the virtual game scene in the field of game development as an example: Figure 3A schematic diagram showing the distance value from the collision detection point to the reference surface included in a virtual object control method in a virtual scene provided according to an embodiment of the present specification is shown, such as Figure 3 As shown: the game scene is an indoor scene A, which includes a target object, a humanoid object X, and a reference surface, which is a surface of a stair terrain 01. There are multiple collision detection points on the humanoid object X, and the humanoid object X moves on the stair terrain 01, and the distance values from the multiple collision detection points on the humanoid object X to the stair terrain 01 are measured.
[0036] In this step, by measuring the distance values between multiple collision detection points on the target object in a dynamic state and the reference surface, a data basis is provided for subsequent steps.
[0037] Step 204: adjusting the component of the motion parameter of the target object in the target direction according to the distance values of the plurality of collision detection points relative to the reference surface, wherein the target direction is the direction of the target object relative to the reference surface; The motion parameters of the target object are used to describe and control the motion of the target object. The motion parameters may include the position, velocity, acceleration and other parameters of the target object. The motion parameters may be preset or automatically configured by a program or system. The motion parameters may include the displacement motion of the target object (such as forward, backward, etc.), the posture motion of the target object (such as pitch, roll, etc.), and the shape change of the target object (such as stretching, shrinking, etc.).
[0038] The target direction is the direction of the target object relative to the reference plane. The target direction can be the direction of the target object perpendicular to the reference plane, or the direction at a certain angle to the reference plane. The target direction can be the same as or different from the actual movement direction of the target object.
[0039] The component of the motion parameter in the target direction refers to the projection part of the motion parameter corresponding to the direction in which the target object moves in the target direction. The component of the motion parameter in the target direction reflects the actual moving speed or change rate of the virtual object in the target direction.
[0040] According to the distance values of the plurality of collision detection points relative to the reference surface, the component of the motion parameter of the target object in the target direction is adjusted, and the specific manner may include multiple manners.
[0041] An optional method is: the average value of the target object relative to the reference surface is calculated based on multiple distance values, and the component of the motion parameter of the target object in the target direction is adjusted based on the comparison of the average value with the preset adjustment threshold. For example, in a mountainous terrain, the surface of the peak is the reference surface, the target object is an unmanned aerial vehicle, and the preset adjustment threshold is the height value of the unmanned aerial vehicle from the ground. The preset adjustment threshold is 30 meters. In the horizontal flight process, the unmanned aerial vehicle measures the distance value to the peak surface through multiple collision detection points at the bottom of the unmanned aerial vehicle, and calculates the average value of the distance between the unmanned aerial vehicle and the peak surface based on the multiple distance values. When the average value is lower than the preset adjustment threshold of 30 meters, the component of the motion parameter of the unmanned aerial vehicle in the target direction is adjusted. The target direction is the vertical upward direction of the unmanned aerial vehicle relative to the peak surface. Then, the projection of the motion parameter of the unmanned aerial vehicle in the vertical direction is adjusted, and the horizontal flight is changed to the oblique upward flight, so that the average value of the distance of the unmanned aerial vehicle relative to the peak surface increases toward the preset adjustment threshold of 30 meters.
[0042] Another optional method is to adjust the component of the motion parameter of the target object in the target direction according to the distance value of the collision detection points at different parts of the target object relative to the reference surface. For example, in an ocean terrain, the sea surface is the reference surface, the target object is a ship, and the bow and stern of the ship have collision detection points respectively. The distance values of the bow and stern from the sea surface are measured respectively. Since the ship needs to adjust the tilt degree of the ship in the horizontal direction with the ups and downs of the sea surface, in order to reasonably simulate the navigation process of the ship, it is necessary to set a reference range of the distance values of the bow and stern from the sea surface to avoid the ship from tilting at an angle that is contrary to the actual situation. If the distance value of the bow and the sea surface is 1 meter, which exceeds the reference range of 3 meters to 5 meters, it means that the bow is about to contact the sea surface. At this time, the target direction is the rotation direction of the vertical line of the straight line connecting the bow and the stern of the ship in the horizontal plane. By adjusting the component of the motion parameter of the ship in the rotation direction, the tilt angle of the ship is restored to normal, that is, the distance value of the bow and the stern relative to the sea surface is restored to within the reference range.
[0043] For example, following the above example, take a virtual game scene in the field of game development as an example: Figure 4 A schematic diagram showing a component of a motion parameter of a target object in a target direction included in a method for controlling a virtual object in a virtual scene according to an embodiment of the present specification is shown, such as Figure 4As shown: the game scene is an indoor scene A, which includes a target object, a humanoid object X, and a reference surface, which is the surface of the stair terrain 01. There are multiple collision detection points on the humanoid object X. The humanoid object X moves on the stair terrain 01, and the distance values from the multiple collision detection points on the humanoid object X to the stair terrain 01 are measured. At time T=0, the distance values from each collision detection point to the stair terrain 01 are equal; at time T=1, the humanoid object X contacts the stair terrain 01, and at this time, the distance values from some of the collision detection points to the stair terrain 01 change, so that the distance value of the humanoid object X from the stair terrain in the target direction becomes smaller. At this time, the component Vy of the motion parameter of the humanoid object X in the target direction is adjusted from 0 to Vy1, and the motion parameter of the target object is V1, that is, it moves along the surface of the stair terrain 01 with Vx1, and moves vertically upward with Vy1, which is reflected as moving with V1.
[0044] In this step, the components of the target object's motion parameters in the target direction are adjusted according to the distance values of multiple collision detection points relative to the reference surface, so that the determined target object's motion parameters are more in line with actual needs, providing a data basis for subsequent steps.
[0045] Step 206: Control the target object to move according to the adjusted motion parameters.
[0046] After the adjusted motion parameters are obtained, the target object can be controlled to move according to the adjusted motion parameters.
[0047] Optionally, the adjustment of the motion parameters is real-time, and the obtained adjusted motion parameters are also updated in real-time. Therefore, controlling the target object to move according to the adjusted motion parameters is also a continuous process. In order to avoid special circumstances (such as incorrect distance value detection, data transmission errors, etc.) that lead to sudden changes in motion parameters, and then cause negative effects (such as jitter, teleportation, etc.) caused by sudden changes in the control of the target object's motion, an optional method is to set a maximum change threshold of the motion parameters, that is, the change value of the motion parameters exceeding the threshold will be limited to the threshold, thereby further ensuring the smoothness of the motion control of the target object. Another optional method is to set an interpolation algorithm (such as linear interpolation, spline interpolation) to smooth the change of motion parameters, that is, the suddenly changed motion parameters can be divided into multiple adjustments to control the target object's motion to avoid sudden acceleration or direction changes.
[0048] In the embodiments of the present specification, by measuring the distance values of multiple collision detection points on the target object relative to the reference surface in real time, and adjusting the components of the motion parameters of the target object in the target direction in real time accordingly, the smooth movement of the virtual object in the target direction when moving on uneven terrain is simulated, reducing the sensitivity of the virtual object to terrain changes in the target direction, avoiding unnecessary jitter or instantaneous movement of the virtual object when it moves, achieving precise control of the movement of the virtual object, and significantly improving the smoothness of the movement of the virtual object on complex terrain. At the same time, the movement of the virtual object is controlled in real time according to the real terrain structure, avoiding visual problems such as object penetration, and improving visual realism.
[0049] In an optional embodiment of the present specification, the distance values of multiple collision detection points on a target object in motion relative to a reference surface are measured, including: emitting collision detection rays along the target direction toward the reference surface through the multiple collision detection points, and determining that the hitting points of the multiple collision detection rays on the reference surface are the collision hitting points corresponding to the multiple collision detection points; and measuring the distance values between the multiple collision detection points and the collision hitting points corresponding to the multiple collision detection points as the distance values of the multiple collision detection points relative to the reference surface.
[0050] A collision detection ray is a ray that is emitted from a collision detection point on the target object along a certain direction (such as the target direction or the reverse direction) toward the reference surface. This ray is used to detect the relative position relationship between the collision detection point and the reference surface. Its function is to detect whether there is an object blocking the ray path and determine the intersection position of the ray with the reference surface or other entities.
[0051] The collision hit point refers to the point where the collision detection ray intersects the reference surface. The collision detection point is the first surface point that is touched during the projection of the collision detection ray. Its function is to enable the system to calculate the actual distance value from the collision detection point to the reference surface.
[0052] Each collision detection point, the collision detection ray emitted by the collision detection point, and the collision concentration point of the collision detection ray on the reference surface correspond one to one.
[0053] The distance value between a collision detection point among multiple collision detection points and the corresponding collision hit point can be determined by measuring the length of the collision detection ray emitted by the collision detection point, or by calculating the coordinates of the collision detection point and the collision hit point. This specification does not make specific limitations on this.
[0054] For example, following the above example, take a virtual game scene in the field of game development as an example: Figure 5A schematic diagram showing a method for measuring distance values of multiple collision detection points relative to a reference surface included in a method for controlling a virtual object in a virtual scene according to an embodiment of the present specification is shown, such as Figure 5 As shown: the game scene is an indoor scene A, in which the target object is a humanoid object X and the reference surface is a surface of the stair terrain 01. There are multiple collision detection points on the humanoid object X, and the humanoid object X moves on the stair terrain 01. When the target direction is determined to be a vertically upward direction perpendicular to the stair terrain 01, the distance values from the multiple collision detection points on the humanoid object X to the stair terrain 01 are measured. Multiple collision detection rays can be emitted from the multiple collision detection points on the humanoid object X to the stair terrain 01, and the hitting points of the multiple collision detection rays on the stair terrain 01 are determined to be the collision hitting points corresponding to the multiple collision detection points. By measuring the lengths of the collision detection rays corresponding to the multiple collision detection points, the distance values of the multiple collision detection points relative to the stair terrain 01 can be determined.
[0055] In the embodiments of this specification, by emitting collision detection rays from multiple collision detection points on the target object to the reference surface, determining the collision hit point of the collision detection ray on the reference surface, and measuring the distance value between the collision hit point and the collision detection point as the distance value of the collision detection point relative to the reference surface, the measurement accuracy and real-time performance of the relative position relationship between the target object and the reference surface are improved, ensuring that the distance difference or position change can be accurately measured in complex terrain or application scenarios, while greatly avoiding measurement errors or measurement omissions. Furthermore, by controlling the emission direction of the collision detection ray, the distance value of the collision detection point relative to the reference surface in different directions can be flexibly measured, which enhances the applicability and flexibility of the system and provides a basis for accurately controlling the movement of the target object.
[0056] In an optional embodiment of the present specification, the target object includes a collision simulation area and a motion buffer area, multiple collision detection points on the target object are located in the collision simulation area, and the motion buffer area is located between the collision simulation area and the reference surface.
[0057] The collision simulation area refers to the area on the target object that actually participates in physical collision detection. This area will simulate the contact or interaction between the virtual object and the reference surface or other entities in detail. The collision simulation area can use capsule colliders, box colliders, sphere colliders, etc.
[0058] The motion buffer is the transition area between the collision simulation area and the reference surface. This area does not participate in physical collision calculations, but serves as a buffer zone to help smooth the movement of virtual objects and provide additional information assistance. For example, for vehicle objects, the wheel part can be set as the motion buffer; for humanoid objects, the part below the knee can be set as the motion buffer.
[0059] Specifically, the motion buffer includes parameters such as a preset buffer distance, a buffer rebound speed, and an interpolation coefficient.
[0060] The preset buffer distance refers to the distance from the bottom of the collision simulation area to the actual reference surface. The specific height depends on the application requirements and is usually set according to the scale of the target object and the expected motion behavior. For example, for a vehicle object, the height of the wheel part can be set as the preset buffer distance, and for a humanoid object, the height of the part below the knee can be set as the preset buffer distance.
[0061] The rebound speed is the speed at which the collision simulation area is lifted upward when the virtual object detects terrain changes within the motion buffer. The rebound speed can be adjusted according to the type of target object or the expected motion characteristics. For example, a slower rebound speed is suitable for simulating slow and steady movements, while a faster speed is suitable for fast reaction scenes.
[0062] The interpolation coefficient is a weighting factor used when calculating the current height of the target object, which is used to smooth the data from multiple collision detection points. The interpolation coefficient can be adjusted according to the needs of the application scenario. A higher interpolation coefficient will make the height change smoother, but the response speed will be slightly slower; a lower interpolation coefficient provides a faster response, but will introduce more fluctuations.
[0063] Since the collision simulation area is an area used for physical collision detection, and the motion buffer does not participate in physical collision calculation, multiple collision detection points of the target object are located in the collision simulation area of the target object.
[0064] The motion buffer is located between the collision simulation area and the reference surface, and is used to buffer the physical collision between the collision simulation area and the reference surface.
[0065] For example, following the above example, take a virtual game scene in the field of game development as an example: Figure 6 A schematic diagram showing the positions of a collision simulation area and a motion buffer zone of a target object included in a virtual object control method in a virtual scene provided according to an embodiment of the present specification is shown. Figure 6As shown: the game scene is an indoor scene A, in which the target object is a humanoid object X and the reference surface is the surface of the stair terrain 01. The part above the knee of the humanoid object X is the collision simulation area, and the part below the knee is the motion buffer area. In this example, in order to measure the distance value of the humanoid object relative to the stair terrain 01, multiple collision detection points are located at the bottom of the collision simulation area (i.e., the knee position). The humanoid object X moves on the stair terrain 01. When it is determined that the target direction is perpendicular to the upper surface of the stair terrain 01 and the direction is vertically upward, the distance values from the multiple collision detection points of the humanoid object X to the stair terrain 01 are measured. Multiple collision detection rays can be emitted from the multiple collision detection points to the stair terrain 01, and the hitting points of the multiple collision detection rays on the stair terrain 01 are determined to be the collision hitting points corresponding to the multiple collision detection points. By measuring the lengths of the collision detection rays corresponding to the multiple collision detection points, the distance values of the multiple collision detection points relative to the stair terrain 01 can be determined, and the motion buffer area is used to buffer the physical collision between the upper body collision simulation area of the humanoid object X and the stair terrain 01.
[0066] In the embodiments of the present specification, by dividing the target object into a collision simulation area and a motion buffer area, the movement control of the virtual object on complex terrain is significantly improved, wherein the collision simulation area is responsible for precise physical collision detection to ensure accurate interaction between key parts and the environment; and the motion buffer area, as a transition area, avoids the jitter problem caused by traditional collision detection, provides smoother height changes and stable terrain adaptability, and by dividing the collision simulation area and the motion buffer area, the realism and stability of the action are enhanced, making the movement of the virtual object more natural and smooth.
[0067] In an optional embodiment of the present specification, the component of the motion parameter of the target object in the target direction is adjusted according to the distance values of the multiple collision detection points relative to the reference plane, including: determining the distance value of the collision simulation area relative to the reference plane according to the distance values of the multiple collision detection points relative to the reference plane and the distance weight values of the multiple collision detection points, wherein the distance weight values of the multiple collision detection points are determined according to the position distribution of the multiple collision detection points in the collision simulation area; adjusting the component of the motion parameter of the target object in the target direction according to the distance value of the collision simulation area relative to the reference plane and the preset distance value.
[0068] The distance weight value refers to the weight assigned to each collision detection point based on its position distribution in the collision simulation area. These weights reflect the importance of different collision detection points to the overall distance measurement of the target object. For example, collision detection points close to key parts (such as the bumper of a car object, the limbs of a human object, etc.) will be given higher weights, while collision detection points far from key parts will have lower weights.
[0069] By introducing the distance weight value, the system can perform weighted averaging on the distance values from multiple collision detection points, thereby more accurately determining the overall distance of the collision simulation area relative to the reference surface. Specifically, the weighted averaging method includes linear weighted average, inverse distance weighting, Gaussian weighting, etc., and the embodiments of this specification do not make specific limitations on this.
[0070] After obtaining the distance values of multiple collision detection points relative to the reference surface and the distance weight values of multiple collision detection points, the distance value of the collision simulation area relative to the reference surface can be determined by weighted average. The distance value of the collision simulation area relative to the reference surface reflects the specific positional relationship between the virtual object and the reference surface.
[0071] The preset distance value is a preset ideal or safe distance standard between the collision simulation area and the reference surface, which is used for comparison with the distance value of the collision simulation area relative to the reference surface actually measured. In this embodiment of the specification, the preset distance value can generally directly apply the preset buffer distance of the motion buffer; in other cases, such as when the motion buffer needs to be continuously compressed or stretched so that the target object maintains a certain degree of elastic motion, the preset distance value can be different from the preset buffer distance of the motion buffer.
[0072] According to the distance value of the collision simulation area relative to the reference surface and the preset distance value, the component of the motion parameter of the target object in the target direction is adjusted. Optionally, if the distance value of the collision simulation area relative to the reference surface is lower than the preset distance value, it means that the target object is too close to the reference surface, and it is necessary to adjust the component of the motion parameter of the target object in the target direction so that the target object is away from the reference surface to increase the distance; conversely, if the distance value of the collision simulation area relative to the reference surface is higher than the preset distance value, it means that the distance needs to be reduced or the current state is maintained. An optional method is to adjust the component of the motion parameter of the target object in the target direction according to the difference between the distance value of the collision simulation area relative to the reference surface and the preset distance value, combined with the rebound speed of the motion buffer.
[0073] For example, following the above example, take a virtual game scene in the field of game development as an example: Figure 7 A schematic diagram showing a component of a motion parameter of a target object in a target direction included in another method for controlling a virtual object in a virtual scene according to an embodiment of the present specification is shown, such as Figure 7As shown: the game scene is an indoor scene A, in which the target object is a humanoid object X and the reference surface is the surface of the stair terrain 01. The part above the knee of the humanoid object X is the collision simulation area, and the part below the knee is the motion buffer. The preset distance value and the preset buffer distance of the motion buffer are both 0.5 meters. The rebound speed of the motion buffer is 0.2 meters per second. Multiple collision detection points are located at the bottom of the collision simulation area (i.e., the knee position). The humanoid object X moves on the stair terrain 01. When it is determined that the target direction is perpendicular to the upper surface of the stair terrain 01 and is vertically upward, multiple collision detection rays are emitted from multiple collision detection points to the stair terrain 01, and the hitting points of the multiple collision detection rays on the stair terrain 01 are determined to be the collision hitting points corresponding to the multiple collision detection points. By measuring the lengths of the collision detection rays corresponding to the multiple collision detection points, the distance values of the multiple collision detection points relative to the stair terrain 01 can be determined, and the corresponding distance weight values are determined according to the distribution of each collision detection point in the collision simulation area, and then the distance value of the collision simulation area relative to the reference surface is determined to be 0.48 meters, which is less than the preset distance value of 0.5 meters. Therefore, it is necessary to adjust the component Vy of the motion parameter of the humanoid object X in the vertical upward direction. According to the rebound speed of 0.2 meters per second and the distance difference of 0.02 meters, it can be concluded that the adjustment amount Vy1 is to move at a speed of 0.2 meters per second in the vertical upward direction for 0.1 seconds.
[0074] In the embodiments of the present specification, a distance weight value is introduced to perform weighted averaging on the distance values of multiple collision detection points, accurately determine the distance value of the collision simulation area relative to the reference surface, and compare it with the preset distance value to dynamically adjust the motion parameters of the target object, thereby achieving precise adjustment of the motion parameters of the target object, thereby controlling the target object to move more accurately, ensuring that the target object can maintain stable and natural movements when moving on complex terrain, and reducing jitter and freezes.
[0075] In an optional embodiment of the present specification, the distance weight values of the multiple collision detection points are determined according to the distance values between the multiple collision detection points and the center point of the collision simulation area.
[0076] The center point of the collision simulation area refers to the geometric center of all collision detection points in the collision simulation area or the center of mass of the collision simulation area. Its function is to serve as a reference benchmark to calculate the relative distance between each collision detection point and the center point of the collision simulation area, thereby determining the distance weight value of each collision detection point.
[0077] The distance between each collision detection point and the center point of the collision simulation area can be determined in a variety of ways. For example, the distribution of each collision detection point can be pre-set to a certain distance when determining the distribution position of each collision detection point; or a plurality of collision detection points can be first distributed on the collision simulation area, and then the distance from each collision detection point to the center point of the collision simulation area is measured by direct measurement, coordinate calculation, etc.
[0078] According to the distance values between multiple collision detection points and the center point of the collision simulation area, a distance weight value is determined. An optional method is that the closer the collision detection point is to the center point of the collision simulation area, the larger the distance weight value is. This method is suitable for application scenarios where the center part of the collision simulation area of the target object needs to be accurately controlled to ensure more natural and smooth movements, such as the torso center of a humanoid object; another optional method is that the farther the collision detection point is from the center point of the collision simulation area, the larger the distance weight value is. This method is suitable for application scenarios where it is necessary to enhance the perception of the edge or peripheral area of the collision simulation area of the target object, such as the periphery (such as bumpers, tires, etc.) of a car object; another optional method is that the larger the distance weight value of the collision detection point within a preset range from the center point of the collision simulation area, for example, if a certain annular structure has a radius of 5 meters and a width of 0.5 meters, the distance weight value of the collision detection point within the range of 4.5-5.5 meters from the center point of the collision simulation area can be set to be the largest. The embodiments of this specification do not make specific limitations on this.
[0079] Alternatively, taking the method that the closer the collision detection point is to the center point of the collision simulation area, the larger the distance weight value is, as an example, it can be calculated by formula (1): (1) Where wi is the distance weight value of the ith collision detection point, ri is the distance between the ith collision detection point and the center point of the collision simulation area, and p is a power parameter, which is usually 2 or higher. When p is 2, formula (2) is obtained: (2) For example, following the above example, take a virtual game scene in the field of game development as an example: Figure 8 A schematic diagram showing a component of a motion parameter of a target object in a target direction included in another method for controlling a virtual object in a virtual scene according to an embodiment of the present specification is shown, such as Figure 8As shown: the game scene is an indoor scene A. The target object is a humanoid object X and the reference surface is the surface of the stair terrain 01, and the height of the staircase is h=0.2 meters per step. The part above the knee of the humanoid object X is the collision simulation area, and the part below the knee is the motion buffer. The preset distance value and the preset buffer distance of the motion buffer are both 0.5 meters. The rebound speed of the motion buffer is 0.2 meters per second. Multiple collision detection points are located at the bottom of the collision simulation area (i.e., the knee position). The humanoid object X moves on the stair terrain 01. When it is determined that the target direction is the vertical upward direction, the distance values of multiple collision detection points relative to the stair terrain 01 are determined. Specifically, collision detection point 001, collision detection point 002, and collision detection point 003 are respectively taken, and their distances from the center point of the collision simulation area of the humanoid object X are: r1=0.1m; r2=0.2m; r3=0.3m The corresponding distance values to stair terrain 01 are: d1=0.5m; d2=0.3m; d3=0.5m Then, the distance weight value corresponding to each collision detection point is calculated using the above formula (2): w1=1 / 0.1^2=100; w2=1 / 0.2^2=25; w3=1 / 0.3^2≈11.11 Each distance weight value is normalized to obtain the normalized distance weight value: w1'=w1 / (w1+w2+w3)=100 / (100+25+11.11)≈0.7347 w2'=w2 / (w1+w2+w3)=25(100+25+11.11)≈0.1837 w3'=w3 / (w1+w2+w3)=11.11 / (100+25+11.11)≈0.0816 Then the distance value of the collision simulation area of humanoid object X relative to stair terrain 01 is: d X =d1·w1'+d2·w2'+d3·w3'=(0.5×0.7347)+(0.3×0.1837)+(0.5×0.0816)≈0.46 meters If the distance value is less than the preset distance value of 0.5 meters, the component of the motion parameter of the humanoid object X in the vertical upward direction needs to be adjusted. According to the rebound speed of 0.2 meters per second and the distance difference of 0.02 meters, it can be concluded that the adjustment amount is to move at a speed of 0.2 meters per second in the vertical upward direction for 0.2 seconds.
[0080] In the embodiments of the present specification, by determining the distance weight value of each collision detection point based on the distance value between multiple collision detection points and the center point of the collision simulation area, the distance value of the collision simulation area relative to the reference surface can be accurately calculated in scenarios with different target objects or environments, and the motion parameters of the target object can be dynamically adjusted based on the distance value, thereby significantly improving the motion control accuracy, stability and smoothness of the virtual object on complex terrain, and enhancing the realism of physical interaction.
[0081] In an optional embodiment of the present specification, the number of collision detection points on a straight line between any collision detection point and the center point of the collision simulation area does not exceed a preset threshold.
[0082] The distribution of the collision detection points in the collision simulation area may be random, may be distributed according to a preset distribution method, or may be distributed manually.
[0083] For example, for a car object, collision detection points can be manually distributed on the chassis, bumper and other parts of the car to better detect the collision of the car object; for a human-shaped object, collision detection points can be distributed in the collision simulation area of the human-shaped object according to a preset distribution method. The embodiments of this specification do not specifically limit the distribution method of collision detection points.
[0084] In practical applications, in order to evenly distribute collision detection points and avoid collision detection points being distributed in one or a limited straight line or area, preferably, the number of collision detection points on the straight line between any collision detection point and the center point of the collision simulation area should not exceed a preset threshold.
[0085] Optionally, taking the distribution of collision detection points according to a preset distribution method as an example, a horizontal plane parallel to the reference plane is selected on the collision simulation area of the target object, and the collision detection points are distributed according to a circular dot matrix. Specifically, the circular dot matrix can be organized into multiple circular layers, each circle represents a layer, the center of each layer is located at the origin, and the radius of each layer increases with the level, so that the outer circle has a larger radius. The radius of each circular layer can be calculated using formula (3): (3) Among them, i represents the i-th circular layer, sensorRows is the total number of layers, and sensorRadius is the maximum radius of the outermost layer.
[0086] There are several collision detection points distributed on each circular layer, wherein the innermost layer, i.e., the center of the circle, is a collision detection point, and the number of collision detection points on each layer from the inner to the outer increases layer by layer, and the specific increase number can be determined according to actual needs. Preferably, it can be increased according to integer multiples, such as 1, 2, 4, 8... or 1, 3, 9, 27, etc. When distributing collision detection points on the circular layer, they can be evenly distributed directly according to the circumference divided by the number of collision detection points, or they can be distributed within a preset range according to a certain preset interval angle, or they can be distributed manually.
[0087] After completing the distribution of collision detection points on each layer, it is also necessary to determine whether the number of collision detection points on the straight line between any collision detection point on each layer and the center point does not exceed the preset threshold. If it is greater, it reflects that the collision detection points between the layers are unevenly distributed, which may cause blind spots in detection and lead to inaccurate detection results. Therefore, it is necessary to adjust the starting angle of each layer so that the collision detection points on each layer are offset from each other.
[0088] Fig. 9 FIG. 1 shows a schematic diagram of a circular dot matrix distribution provided by an embodiment of the present specification, such as Fig. 9 As shown, the collision detection points are distributed to each circular layer according to methods 1, 2, 4, 8, and 16, and a coordinate system is constructed with the center point (center of the circle) as the origin, and the horizontal direction is the X-axis. For each layer except the origin, the angle between the starting distribution angle and the X-axis can be obtained by dividing the circumference (i.e., 360°) by the number of collision detection points on the layer (i.e., divided by 2, 4, 8, and 16, respectively), and the starting distribution angles of each layer are 180°, 90°, 45°, and 22.5°. At this time, the number of collision detection points on the straight line between any collision detection point and the center point does not exceed the preset threshold value 3, which indicates that the distribution of collision detection points is relatively uniform.
[0089] It should be noted that the above method of distributing collision detection points in a circular dot matrix is also applicable to the distribution of triangles, quadrilaterals or other polygonal dot matrices. The specific method is similar to the above circular dot matrix distribution method and will not be enumerated here.
[0090] In the embodiments of the present specification, by limiting the number of collision detection points on the straight line between any collision detection point and the center point of the collision simulation area to no more than a preset threshold, a uniform distribution of detection points is ensured, and problems such as detection blind spots and inaccurate results are avoided, thereby significantly improving the measurement accuracy and reliability of collision detection.
[0091] In an optional embodiment of the present specification, after adjusting the component of the motion parameters of the target object in the target direction according to the distance values of multiple collision detection points relative to the reference surface, it also includes: determining the action parameters of the motion buffer using an inverse kinematics algorithm based on the motion parameters; and controlling the motion buffer to execute the target action based on the action parameters.
[0092] Inverse Kinematics (IK) is a technique used to calculate joint angles or other parameters so that the end effector can reach a specified position and orientation. In a virtual environment, IK is used to ensure that the parts of a virtual object can naturally adapt to terrain changes. For example, for a humanoid object, the feet of the humanoid object are accurately placed on a step or on the surface of an object.
[0093] Action parameters refer to a set of variables that describe the action performance of each part of the virtual object, including but not limited to: the angle, position, direction, speed and acceleration of movement, force and torque of each part.
[0094] After adjusting the component of the motion parameter of the target object in the target direction, since the motion buffer does not participate in the physical collision calculation, it is necessary to determine the motion parameters of the motion buffer through the inverse kinematics algorithm, and control the target object part in the motion buffer to perform the target action, so as to ensure that the action of the target object conforms to the actual physical law. For example, for a humanoid object, since the collision simulation area above the knee moves due to the influence of physical collision, the limbs (calf and foot) in the motion buffer below the knee may stay in place or simply follow the collision simulation area to drag if the target action is not performed; for a launched rocket object, if the main part of the rocket is set as the collision simulation area, the flame ejected by the rocket in the motion buffer does not participate in the physical collision calculation, so it may appear to be ejected or escaped in a random direction. Therefore, for the target object part in the motion buffer, it is necessary to use the inverse kinematics algorithm to control the motion buffer to perform the target action, so that the movement of the entire target object is natural and reasonable, and conforms to the actual physical law.
[0095] Optionally, when using the inverse kinematics algorithm to determine the motion parameters of the motion buffer, the animation system method can be used to determine it, that is, if a predefined animation sequence is used, the appropriate animation clip can be selected according to the motion parameters and appropriate interpolation can be performed to ensure a smooth transition; the physical simulation method can also be used, that is, if it is a simulation based on physical laws, the calculated force and torque can be directly applied to drive the movement of each part to ensure that the action complies with the laws of physics.
[0096] For example, the above example is used to take a virtual game scene in the field of game development as an example: the game scene is an indoor scene A. The target object is a humanoid object X and the reference surface is the surface of the stair terrain 01. After determining the motion parameters of the humanoid object X moving at a speed of 0.2 meters per second for 0.1 seconds in the vertical upward direction, the motion parameters of the calf and foot in the motion buffer can be determined based on the motion parameters using the inverse kinematics algorithm, so that the calf and foot parts complete the target action of lifting and falling, and complete the motion process of the humanoid object X moving on the stair terrain 01.
[0097] In the embodiments of the present specification, after adjusting the motion parameters of the target object, the motion parameters of the motion buffer are determined using an inverse kinematics algorithm, and the motion buffer is controlled to execute the target action, thereby ensuring that the movement of the target object is natural, reasonable and in compliance with physical laws, avoiding unnatural stagnation or dragging in the motion buffer, and significantly improving the smoothness and authenticity of the movement of the virtual object on complex terrain.
[0098] In an optional embodiment of the present specification, after controlling the target object to move according to the adjusted motion parameters, it also includes: measuring the distance value of the position calibration point on the target object converted to a stationary state relative to multiple collision hit points on a reference surface; adjusting the position parameters of the target object according to the distance value of the position calibration point relative to the multiple collision hit points on the reference surface.
[0099] Position calibration points refer to specific points or areas pre-defined on the target object, which are used to measure and adjust its final position relative to the reference surface. Position calibration points are usually selected at key locations. For example, for human-shaped objects, position calibration points can be the center of the foot, the end of the hand, etc. For automobile objects, position calibration points can be the bottom of the tire, the center of the car chassis, etc. Position calibration points are used to accurately reflect the relative relationship or collision between the target object and the reference surface.
[0100] Position parameters refer to a set of variables that describe the specific position of a target object in a virtual scene, including but not limited to: coordinate values, rotation angles and other parameters.
[0101] Transition to a static state means that after the target object has completed a certain stage of motion, it is set to a state where it is temporarily no longer affected by external forces or dynamics. In this state, the position and posture of the target object remain unchanged, which facilitates accurate measurement and adjustment. For example, in a virtual environment, when a humanoid object completes a jump and lands, it can be set to a static state to ensure that it will not be affected when measuring the humanoid object.
[0102] The distance value of the position calibration point on the target object relative to the multiple collision hit points on the reference surface can be determined according to a variety of methods. For example, the distance value from the position calibration point to each collision hit point on the reference surface can be directly measured by ray detection, spherical detection and other detection methods, and can also be determined by calculation based on the coordinates of the position calibration point and the coordinates of multiple collision hit points on the reference surface.
[0103] In the embodiments of the present specification, by measuring the distance values of the position calibration point relative to multiple collision hit points on the reference surface when the target object is converted to a stationary state, the position parameters of the target object are accurately adjusted to ensure that its final position is accurate and conforms to the laws of physics, thereby improving the positioning accuracy and stability of the target object on complex terrain, avoiding problems such as suspension or embedding in the ground, and making the movement of the target object more natural and smooth.
[0104] In an optional embodiment of the present specification, measuring the distance value of a position calibration point on a target object converted to a stationary state relative to multiple collision hit points on a reference surface includes: emitting collision detection rays along multiple directions to the reference surface through the position calibration point, and determining that the hit points of the multiple collision detection rays on the reference surface are multiple collision hit points corresponding to the position calibration point; measuring the distance value between the position calibration point and the multiple collision hit points as the distance value of the position calibration point relative to the multiple collision hit points on the reference surface.
[0105] To determine the distance value of the position calibration point relative to multiple collision hit points on the reference surface, collision detection rays can be emitted to the reference surface along multiple directions through the position calibration point. For example, multiple collision detection rays can be emitted to the reference surface in a cone range of a certain angle with the position calibration point as the vertex; multiple collision detection rays can also be emitted evenly to the reference surface with the position calibration point as the center of a sphere.
[0106] The hitting points of multiple collision detection rays on the reference surface are the multiple collision hitting points corresponding to the position calibration point. By measuring the distance value between the position calibration point and the multiple collision hitting points, that is, the length of the multiple collision detection rays, the distance value from the position calibration point to the multiple collision hitting points on the reference surface can be determined.
[0107] For example, following the above example, take a virtual game scene in the field of game development as an example: Fig.10 A schematic diagram showing a method for controlling a virtual object in a virtual scene according to an embodiment of the present specification includes adjusting position parameters of a target object in a stationary state. Fig.10As shown: the game scene is an indoor scene A. The target object is a humanoid object X and the reference surface is the surface of the stair terrain 01. When the humanoid object X is converted from a moving state to a stationary state, the humanoid object C may be located on a certain step of stairs or between certain steps of stairs. At this time, it is necessary to respectively emit collision detection rays to the surface of the stair terrain 01 in multiple directions through the position calibration point of the humanoid object X, determine that the hitting points of the multiple collision detection rays on the surface of the stair terrain 01 are multiple collision hitting points corresponding to the position calibration point, measure the distance value between the position calibration point and the multiple collision hitting points as the distance value of the position calibration point relative to the multiple collision hitting points on the surface of the stair terrain 01, and adjust the position parameters of the humanoid object X according to the distance value of the position calibration point relative to the multiple collision hitting points on the reference surface, that is, adjust the exact position on which step of stairs the humanoid object X should finally stand, so that the humanoid object X makes a corresponding standing action.
[0108] In the embodiments of the present specification, collision detection rays are emitted from the position calibration point to the reference surface in multiple directions to determine multiple collision hit points, and the distance values between these hit points and the position calibration point are measured, so as to accurately adjust the position parameters of the target object, thereby improving the positioning accuracy and stability of the target object on complex terrain, ensuring that its final position is accurate and in compliance with physical laws, and avoiding possible omissions in single-direction detection through multi-angle detection, thereby enhancing the naturalness and smoothness of the movement.
[0109] Fig.11 A flowchart of a method for controlling motion of a humanoid object in a virtual scene according to an embodiment of the present specification is shown. Figure 3 As shown: the method specifically comprises the following steps.
[0110] Step 1102: measuring the distance values of a plurality of collision detection points on the moving humanoid object relative to the stair plane.
[0111] Step 1104: adjusting the component of the motion parameter of the humanoid object in the target direction according to the distance values of the plurality of collision detection points relative to the plane of the stairs, wherein the target direction is the direction of the humanoid object relative to the plane of the stairs.
[0112] Step 1106: Control the humanoid object to move according to the adjusted motion parameters.
[0113] The above is a schematic scheme of a method for controlling the motion of a humanoid object in a virtual scene of the present embodiment. It should be noted that the technical scheme of the method for controlling the motion of a humanoid object in a virtual scene and the technical scheme of the method for controlling the motion of a virtual object in the virtual scene described above belong to the same concept, and the details not described in detail in the technical scheme of the method for controlling the motion of a humanoid object in a virtual scene can be referred to the description of the technical scheme of the method for controlling the motion of a virtual object in the virtual scene described above.
[0114] The following combination Fig.12 To Attachment Fig.14 Taking the application of the virtual object motion control method in a virtual scene provided in this specification in a virtual game scene as an example, the virtual object motion control method in a virtual scene is further described. Fig.12 A schematic diagram of a processing process of a method for controlling motion of a virtual object in a virtual scene provided according to an embodiment of the present specification is shown. Fig.13 A flowchart of a processing process of a method for controlling motion of a virtual object in a virtual scene provided by an embodiment of the present specification is shown. Fig.14 A schematic diagram of the structure of a method for controlling the motion of a humanoid object in a virtual scene provided by an embodiment of the present specification is shown.
[0115] like Fig.12 As shown: at time T=0, the distances from each collision detection point to the staircase terrain 01 are equal; At time T=1, the humanoid object X contacts the stair terrain 01. At this time, the distance values of a small number of collision detection points to the stair terrain 01 change, so that the distance value of the humanoid object X from the stair terrain changes less in the target direction. At this time, the component Vy of the motion parameter of the humanoid object X in the target direction is adjusted from 0 to Vy1. The motion parameter of the target object is V1, that is, it moves along the surface of the stair terrain 01 with Vx1 and moves vertically upward with Vy1, which is reflected as moving with V1; At time T=2, the humanoid object X continues to contact the stair terrain 01. At this time, the distance values of many collision detection points to the stair terrain 01 change, so that the distance value of the humanoid object X from the stair terrain changes greatly in the target direction. At this time, the component Vy of the motion parameter of the humanoid object X in the target direction is adjusted from Vy1 to Vy2, and the motion parameter of the target object is V2, that is, it moves along the surface of the stair terrain 01 with Vx2 and moves vertically upward with Vy2, which is reflected as moving with V2; At time T=3, the humanoid object X continues to contact the stair terrain 01. At this time, the distance values from more collision detection points to the stair terrain 01 change, causing the distance value of the humanoid object X from the stair terrain to change greatly in the target direction. At this time, the component Vy of the motion parameter of the humanoid object X in the target direction is adjusted from Vy2 to Vy3, and the motion parameter of the target object is V3, that is, it moves along the surface of the stair terrain 01 with Vx3 and moves vertically upward with Vy3, which is reflected as moving with V3; At time T=4, the humanoid object X continues to contact the stair terrain 01. At this time, the distance values from most of the collision detection points to the stair terrain 01 change, so that the distance value of the humanoid object X from the stair terrain in the target direction changes less. At this time, the component Vy of the motion parameter of the humanoid object X in the target direction is adjusted from Vy3 to Vy4, and the motion parameter of the target object is V4, that is, it moves along the surface of the stair terrain 01 with Vx4 and moves vertically upward with Vy4, which is reflected as moving with V4; At time T=5, the humanoid object X is completely in contact with the stair terrain 01. At this time, the distance values from all collision detection points to the stair terrain 01 are equal, so that the distance value of the humanoid object X from the stair terrain no longer changes in the target direction. At this time, the component Vy of the motion parameter of the humanoid object X in the target direction is adjusted from Vy4 to 0, and the motion parameter of the target object is V5, that is, it only moves along the surface of the stair terrain 01 with V5.
[0116] Corresponding to the above process, Fig.13 As shown, the method for controlling the motion of a virtual object in a virtual scene specifically includes the following steps.
[0117] Step 1302: Collision detection rays are emitted respectively along the target direction toward the stair plane through multiple collision detection points on the human-shaped object in motion, and the hitting points of the multiple collision detection rays on the stair plane are determined to be the collision hitting points corresponding to the multiple collision detection points, wherein the human-shaped object includes a collision simulation area above the knee and a motion buffer area below the knee, the multiple collision detection points on the human-shaped object are located in the collision simulation area above the knee, and the motion buffer area below the knee is located between the collision simulation area above the knee and the stair plane.
[0118] Step 1304: measuring distance values between the plurality of collision detection points and the collision hitting points corresponding to the plurality of collision detection points as distance values of the plurality of collision detection points relative to the stair plane.
[0119] Step 1306: Determine the distance value of the collision simulation area above the knee relative to the stair plane based on the distance values of the multiple collision detection points relative to the stair plane and the distance weight values of the multiple collision detection points, wherein the distance weight values of the multiple collision detection points are determined based on the distance values between the multiple collision detection points and the center point of the collision simulation area above the knee, and the number of collision detection points on the straight line between any collision detection point and the center point of the collision simulation area above the knee does not exceed a preset threshold.
[0120] Step 1308: According to the distance value of the collision simulation area above the knee relative to the stair plane and the preset distance value, adjust the component of the motion parameter of the humanoid object in the target direction, wherein the target direction is the direction of the humanoid object relative to the stair plane.
[0121] Step 1310: Determine the motion parameters of the motion buffer area below the knee using an inverse kinematics algorithm based on the motion parameters. Control the motion buffer area below the knee area to perform the target motion based on the motion parameters.
[0122] Step 1312: Control the humanoid object to move according to the adjusted motion parameters.
[0123] Step 1314: emitting collision detection rays along multiple directions toward the stair plane respectively through the position calibration point, and determining that the hit points of the multiple collision detection rays on the stair plane are the multiple collision hit points corresponding to the position calibration point.
[0124] Step 1316: Measure the distance value between the position calibration point and the multiple collision hitting points as the distance value of the position calibration point relative to the multiple collision hitting points on the stair plane.
[0125] Step 1318: Adjust the position parameters of the humanoid object according to the distance value of the position calibration point relative to the multiple collision hit points on the stair plane.
[0126] Corresponding to the above method, Fig.14 As shown, the structure of the humanoid object motion control method includes: the part above the knee of the humanoid object is the collision simulation area, the part below the knee is the motion buffer area, and the radius of each circular layer in the circular dot matrix is the distance value of the collision detection point on the layer relative to the center point of the collision simulation area. When the humanoid object is located on the stair plane, the distance value of the collision detection point relative to the stair plane can be measured by emitting a collision detection ray from the collision detection point to the stair plane along the target direction.
[0127] Corresponding to the above method embodiment, this specification also provides an embodiment of a virtual object motion control device in a virtual scene, Fig.15 FIG. 1 is a schematic diagram showing a structure of a virtual object motion control device in a virtual scene provided by an embodiment of the present specification. Fig.15 As shown, the device comprises: The first measurement module 1501 is configured to measure distance values of a plurality of collision detection points on a target object in motion relative to a reference surface; A first adjustment module 1502 is configured to adjust a component of a motion parameter of a target object in a target direction according to distance values of a plurality of collision detection points relative to a reference surface, wherein the target direction is a direction of the target object relative to the reference surface; The first control module 1503 is configured to control the target object to move according to the adjusted motion parameters.
[0128] Optionally, the first measurement module 1501 is further configured to emit collision detection rays along the target direction toward the reference surface through multiple collision detection points, determine the hitting points of the multiple collision detection rays on the reference surface as the collision hitting points corresponding to the multiple collision detection points; and measure the distance values between the multiple collision detection points and the collision hitting points corresponding to the multiple collision detection points as the distance values of the multiple collision detection points relative to the reference surface.
[0129] Optionally, in the device, the target object includes a collision simulation area and a motion buffer area, a plurality of collision detection points on the target object are located in the collision simulation area, and the motion buffer area is located between the collision simulation area and the reference surface.
[0130] Optionally, the first adjustment module 1502 is further configured to determine the distance value of the collision simulation area relative to the reference surface based on the distance values of the multiple collision detection points relative to the reference surface and the distance weight values of the multiple collision detection points, wherein the distance weight values of the multiple collision detection points are determined based on the position distribution of the multiple collision detection points in the collision simulation area; and adjust the component of the motion parameter of the target object in the target direction based on the distance value of the collision simulation area relative to the reference surface and the preset distance value.
[0131] Optionally, in the device, distance weight values of the multiple collision detection points are determined according to distance values between the multiple collision detection points and a center point of the collision simulation area.
[0132] Optionally, in the device, the number of collision detection points on a straight line between any collision detection point and a center point of the collision simulation area does not exceed a preset threshold.
[0133] Optionally, the device further comprises an action execution unit configured to: determine the action parameters of the motion buffer using an inverse kinematics algorithm according to the motion parameters; and control the motion buffer to execute the target action according to the action parameters.
[0134] Optionally, the device also includes a position parameter adjustment unit, which is configured to: measure the distance value of the position calibration point on the target object converted to a stationary state relative to multiple collision hit points on the reference surface; and adjust the position parameter of the target object according to the distance value of the position calibration point relative to the multiple collision hit points on the reference surface.
[0135] Optionally, the position parameter adjustment unit is further configured to emit collision detection rays to the reference surface along multiple directions through the position calibration point, determine the hitting points of the multiple collision detection rays on the reference surface as the multiple collision hitting points corresponding to the position calibration point; measure the distance value between the position calibration point and the multiple collision hitting points as the distance value of the position calibration point relative to the multiple collision hitting points on the reference surface.
[0136] The above is a schematic scheme of a virtual object motion control device in a virtual scene of this embodiment. It should be noted that the technical scheme of the virtual object motion control device in the virtual scene and the technical scheme of the virtual object motion control method in the virtual scene belong to the same concept, and the details of the technical scheme of the virtual object motion control device in the virtual scene that are not described in detail can all be referred to the description of the technical scheme of the virtual object motion control method in the virtual scene.
[0137] Corresponding to the above method embodiment, this specification also provides an embodiment of a humanoid object motion control device in a virtual scene, Fig.16 FIG. 1 is a schematic diagram showing a structure of a humanoid object motion control device in a virtual scene provided by an embodiment of the present specification. Fig.16 As shown, the device comprises: The second measurement module 1601 is configured to measure the distance values of multiple collision detection points on the moving humanoid object relative to the stair plane; The second adjustment module 1602 is configured to adjust the component of the motion parameter of the humanoid object in the target direction according to the distance values of the plurality of collision detection points relative to the plane of the stairs, wherein the target direction is the direction of the humanoid object relative to the plane of the stairs; The second control module 1603 is configured to control the humanoid object to move according to the adjusted motion parameters.
[0138] The above is a schematic scheme of a humanoid object motion control device in a virtual scene of this embodiment. It should be noted that the technical scheme of the humanoid object motion control device in the virtual scene and the technical scheme of the humanoid object motion control method in the virtual scene belong to the same concept, and the details of the technical scheme of the humanoid object motion control device in the virtual scene that are not described in detail can all be referred to the description of the technical scheme of the humanoid object motion control method in the virtual scene.
[0139] Fig.17 The structure block diagram of a computing device provided by an embodiment of the present specification is shown. The components of the computing device 1700 include but are not limited to a memory 1710 and a processor 1720. The processor 1720 is connected to the memory 1710 via a bus 1730, and the database 1750 is used to store data.
[0140] The computing device 1700 also includes an access device 1740, which enables the computing device 1700 to communicate via one or more networks 1760. Examples of these networks include a Public Switched Telephone Network (PSTN), a Local Area Network (LAN), a Wide Area Network (WAN), a Personal Area Network (PAN), or a combination of communication networks such as the Internet. The access device 1740 may include one or more of any type of network interface (e.g., a Network Interface Controller (NIC)) of wired or wireless, such as an IEEE 802.11 Wireless Local Area Network (WLAN) wireless interface, a Worldwide Interoperability for Microwave Access (Wi-MAX) interface, an Ethernet interface, a Universal Serial Bus (USB) interface, a cellular network interface, a Bluetooth interface, and a Near Field Communication (NFC).
[0141] In one embodiment of the present specification, the above components of the computing device 1700 and Fig.17 Other components not shown in the figure may also be connected to each other, for example, via a bus. It should be understood that Fig.17 The computing device structure block diagram shown is only for the purpose of illustration, and is not intended to limit the scope of this specification. Those skilled in the art can add or replace other components as needed.
[0142] The computing device 1700 may be any type of stationary or mobile computing device, including a mobile computer or mobile computing device (e.g., a tablet computer, a personal digital assistant, a laptop computer, a notebook computer, a netbook, etc.), a mobile phone (e.g., a smart phone), a wearable computing device (e.g., a smart watch, smart glasses, etc.), or other types of mobile devices, or a stationary computing device such as a desktop computer or a personal computer (PC). The computing device 1700 may also be a mobile or stationary server.
[0143] The processor 1720 is used to execute the following computer program / instruction, which, when executed by the processor, implements the steps of the method for controlling the motion of a virtual object in the above virtual scene.
[0144] The above is a schematic scheme of a computing device of this embodiment. It should be noted that the technical scheme of the computing device and the technical scheme of the virtual object motion control method in the above virtual scene belong to the same concept, and the details not described in detail in the technical scheme of the computing device can be referred to the description of the technical scheme of the virtual object motion control method in the above virtual scene.
[0145] An embodiment of the present specification further provides a computer-readable storage medium storing a computer program / instruction, which implements the steps of the above-mentioned method for controlling the motion of a virtual object in a virtual scene when executed by a processor.
[0146] The above is a schematic scheme of a computer-readable storage medium of this embodiment. It should be noted that the technical scheme of the storage medium and the technical scheme of the virtual object motion control method in the above virtual scene belong to the same concept, and the details not described in detail in the technical scheme of the storage medium can be referred to the description of the technical scheme of the virtual object motion control method in the above virtual scene.
[0147] An embodiment of the present specification also provides a computer program product, including a computer program / instruction, which, when executed by a processor, implements the steps of the above-mentioned method for controlling the motion of a virtual object in a virtual scene.
[0148] The above is a schematic scheme of a computer program product of this embodiment. It should be noted that the technical scheme of the computer program product and the technical scheme of the virtual object motion control method in the virtual scene described above belong to the same concept, and the details not described in detail in the technical scheme of the computer program product can be referred to the description of the technical scheme of the virtual object motion control method in the virtual scene described above.
[0149] The above is a description of a specific embodiment of the present specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0150] The computer instructions include computer program codes, which may be in source code form, object code form, executable files or some intermediate forms, etc. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, USB flash drive, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electric carrier signal, telecommunication signal and software distribution medium, etc. It should be noted that the contents contained in the computer-readable medium may be appropriately increased or decreased according to the requirements of patent practice. For example, in some regions, according to patent practice, computer-readable media do not include electric carrier signals and telecommunication signals.
[0151] It should be noted that, for the above-mentioned method embodiments, for the sake of simplicity of description, they are all described as a series of action combinations, but those skilled in the art should be aware that the embodiments of this specification are not limited by the order of the actions described, because according to the embodiments of this specification, some steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required for the embodiments of this specification.
[0152] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0153] The preferred embodiments of this specification disclosed above are only used to help explain this specification. The optional embodiments do not describe all the details in detail, nor do they limit the invention to only the specific implementation methods described. Obviously, many modifications and changes can be made according to the content of the embodiments of this specification. This specification selects and specifically describes these embodiments in order to better explain the principles and practical applications of the embodiments of this specification, so that technicians in the relevant technical field can well understand and use this specification. This specification is only limited by the claims and their full scope and equivalents.
Claims
1. A method for controlling the motion of a virtual object in a virtual scene, characterized in that: include: Measuring the distance values of multiple collision detection points on the target object in motion relative to the reference surface; According to the distance values of the plurality of collision detection points relative to the reference surface, adjusting the component of the motion parameter of the target object in the target direction, wherein the target direction is the direction of the target object relative to the reference surface; The target object is controlled to move according to the adjusted motion parameters.
2. The method according to claim 1, characterized in that: The step of measuring distance values of a plurality of collision detection points on a target object in motion relative to a reference surface comprises: By respectively emitting collision detection rays along the target direction toward the reference surface through the multiple collision detection points, the hitting points of the multiple collision detection rays on the reference surface are determined to be the collision hitting points corresponding to the multiple collision detection points; The distance values between the plurality of collision detection points and the collision hitting points corresponding to the plurality of collision detection points are measured as the distance values of the plurality of collision detection points relative to the reference surface.
3. The method according to claim 1, characterized in that: The target object comprises a collision simulation area and a motion buffer area, a plurality of collision detection points on the target object are located in the collision simulation area, and the motion buffer area is located between the collision simulation area and the reference surface.
4. The method according to claim 3, characterized in that: The step of adjusting the component of the motion parameter of the target object in the target direction according to the distance values of the plurality of collision detection points relative to the reference surface comprises: Determining the distance value of the collision simulation area relative to the reference surface according to the distance values of the multiple collision detection points relative to the reference surface and the distance weight values of the multiple collision detection points, wherein the distance weight values of the multiple collision detection points are determined according to the position distribution of the multiple collision detection points in the collision simulation area; According to the distance value of the collision simulation area relative to the reference surface and the preset distance value, the component of the motion parameter of the target object in the target direction is adjusted.
5. The method according to claim 4, characterized in that: The distance weight values of the plurality of collision detection points are determined according to the distance values between the plurality of collision detection points and the center point of the collision simulation area.
6. The method according to claim 5, characterized in that: The number of collision detection points on a straight line between any collision detection point and the center point of the collision simulation area does not exceed a preset threshold.
7. The method according to claim 3, characterized in that: After adjusting the component of the motion parameter of the target object in the target direction according to the distance values of the plurality of collision detection points relative to the reference surface, the method further includes: Determine the motion parameters of the motion buffer using an inverse kinematics algorithm according to the motion parameters; According to the action parameters, the motion buffer is controlled to execute a target action.
8. The method according to claims 1-7, characterized in that: After controlling the target object to move according to the adjusted motion parameters, the method further includes: Measuring distance values of a position calibration point on a target object converted to a stationary state relative to a plurality of collision hitting points on a reference surface; The position parameters of the target object are adjusted according to the distance value of the position calibration point relative to a plurality of collision hit points on the reference surface.
9. The method according to claim 8, characterized in that: The distance value of the position calibration point on the target object converted to a stationary state relative to the multiple collision hitting points on the reference surface is measured, including: By using the position calibration point to emit collision detection rays to the reference surface in multiple directions, the collision detection rays hitting points on the reference surface are determined to be the collision hitting points corresponding to the position calibration point; The distance value between the position calibration point and the multiple collision hitting points is measured as the distance value of the position calibration point relative to the multiple collision hitting points on the reference surface.
10. A method for controlling the motion of a humanoid object in a virtual scene, characterized in that: include: Measuring the distance values of multiple collision detection points on the moving humanoid object relative to the stair plane; According to the distance values of the plurality of collision detection points relative to the plane of the stairs, adjusting the component of the motion parameter of the human-shaped object in the target direction, wherein the target direction is the direction of the human-shaped object relative to the plane of the stairs; The humanoid object is controlled to move according to the adjusted motion parameters.
11. A virtual object motion control device in a virtual scene, characterized in that: include: A first measurement module is configured to measure distance values of a plurality of collision detection points on a target object in motion relative to a reference surface; a first adjustment module, configured to adjust a component of a motion parameter of the target object in a target direction according to distance values of the plurality of collision detection points relative to a reference surface, wherein the target direction is a direction of the target object relative to the reference surface; The first control module is configured to control the target object to move according to the adjusted motion parameters.
12. A motion control device for a humanoid object in a virtual scene, characterized in that: include: A second measurement module is configured to measure distance values of a plurality of collision detection points on the moving humanoid object relative to the plane of the stairs; a second adjustment module, configured to adjust the component of the motion parameter of the human-shaped object in a target direction according to the distance values of the plurality of collision detection points relative to the plane of the stairs, wherein the target direction is the direction of the human-shaped object relative to the plane of the stairs; The second control module is configured to control the humanoid object to move according to the adjusted motion parameters.
13. A computing device, characterized in that: include: Memory and processor; The memory is used to store computer programs / instructions, and the processor is used to execute the computer programs / instructions. When the computer programs / instructions are executed by the processor, the steps of the method described in any one of claims 1 to 10 are implemented.
14. A computer-readable storage medium, characterized in that: It stores a computer program / instruction, which implements the steps of the method described in any one of claims 1 to 10 when executed by a processor.
15. A computer program product, characterized in that The invention comprises a computer program / instruction, which, when executed by a processor, implements the steps of the method according to any one of claims 1 to 10.