Object Control Method and Device
By determining the locking plane and rotation axis and controlling the pose transformation of the driven object, the problem of loss of rotation dimensions in three-dimensional animation is solved, and the accuracy and effect of the animation is improved.
Patent Information
- Application Number
- CN202210744391.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-06-28
- Publication Date
- 2025-07-11
- Estimated Expiration
- 2042-06-28
AI Technical Summary
In three-dimensional animation, the three-axis rotation transformation of an animation object is prone to lose the rotation dimension of one axis, resulting in low accuracy of animation transformation and poor animation effect.
By obtaining the pose parameters of the active object and the driven object, determining the transformation component on the locking plane and the locking rotation axis, controlling the driven object to rotate a predetermined angle along the locking rotation axis, and avoiding the loss of the rotation dimension of the three-axis superposition rotation.
Improve the accuracy of the pose transformation of the driven object and optimize the animation effect.
Smart Images

Figure CN115100324B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, and particularly to an object control method. This application also relates to an object control device, a computing device, and a computer-readable storage medium. Background Art
[0002] With the development of computer technology, two-dimensional images and three-dimensional images have emerged as the times require. Since three-dimensional images are more intuitive than two-dimensional images and can give viewers a more immersive feeling, three-dimensional graphics technology has been increasingly valued by people.
[0003] In the prior art, in three-dimensional animations, the animation state of an animation object can be controlled by a controller. When controlling the animation state of the animation object, three-axis rotation transformation is often involved. For the local coordinates of dynamic transformation, the superposition rotation of the three axes is likely to lose the rotation dimension of one axis, resulting in a low accuracy rate of animation transformation and a poor animation effect. Therefore, an effective solution is urgently needed to solve the above problems. Summary of the Invention
[0004] In view of this, embodiments of this application provide an object control method to solve the technical defects existing in the prior art. Embodiments of this application also provide an object control device, a computing device, and a computer-readable storage medium.
[0005] According to a first aspect of an embodiment of this application, an object control method is provided, including:
[0006] Obtain a first pose parameter of an active object and a second pose parameter of a driven object, where the active object is used to control the pose transformation of the driven object;
[0007] Determine a transformation component of the driven object on a locked plane according to the first pose parameter and the second pose parameter, where the locked plane is determined based on locked coordinate axes;
[0008] Determine a locked rotation axis and a rotation angle of the driven object according to an initial direction vector of the driven object and the transformation component;
[0009] Control the driven object to rotate by the rotation angle along the locked rotation axis.
[0010] Optionally, the determining the transformation component of the driven object on the locked plane according to the first pose parameter and the second pose parameter includes:
[0011] Determine a constraint vector of the driven object facing the active object according to the first pose parameter and the second pose parameter;
[0012] Determine the projection vector of the constraint vector on the locking plane according to the first pose parameter and the second pose parameter;
[0013] Use the projection vector as the transformation component of the driven object on the locking plane.
[0014] Optionally, the determining the locking rotation axis and rotation angle of the driven object according to the initial direction vector and the transformation component of the driven object includes:
[0015] Determine a perpendicular vector that is perpendicular to both the initial direction vector and the transformation component, and use the perpendicular vector as the locking rotation axis;
[0016] Determine the vector angle between the transformation component and the initial direction vector, and use the vector angle as the rotation angle.
[0017] Optionally, the determining the vector angle between the transformation component and the initial direction vector includes:
[0018] Determine the vector inner product between the transformation component and the initial direction vector;
[0019] Determine the first vector length of the transformation component and the second vector length of the initial direction vector;
[0020] Determine the vector angle between the transformation component and the initial direction vector according to the vector inner product, the first vector length, and the second vector length.
[0021] Optionally, before determining the transformation component of the driven object on the locking plane according to the first pose parameter and the second pose parameter, it further includes:
[0022] Determine the projection coordinate axes in the target coordinate system other than the locking coordinate axes, where the target coordinate system is a coordinate system established based on the driven object;
[0023] Use the plane formed by the projection coordinate axes as the locking plane.
[0024] Optionally, the controlling the driven object to rotate by the rotation angle along the locking rotation axis includes:
[0025] Obtain the control weight of the active object on the driven object;
[0026] Determine the target rotation angle of the driven object according to the control weight;
[0027] Control the driven object to rotate by the target rotation angle along the locking rotation axis.
[0028] Optionally, there are at least two active objects; before obtaining the first pose parameter of the active object, it further includes:
[0029] Obtaining the control order of at least two active objects;
[0030] Determining a target active object from the at least two active objects according to the control order, where the target active object is the active object currently controlling the pose transformation of the driven object;
[0031] Correspondingly, obtaining the first pose parameter of the active object includes:
[0032] Obtaining the first pose parameter of the target active object.
[0033] Optionally, after controlling the driven object to rotate the rotation angle along the locked rotation axis, it further includes:
[0034] Determining the next active object of the target active object according to the control order;
[0035] Taking the next active object as the target active object.
[0036] Optionally, the active object is the control bone in the current animation frame, and the driven object is the constrained bone in the current animation frame.
[0037] According to the second aspect of the embodiments of the present application, an object control device is provided, including:
[0038] An acquisition module configured to acquire the first pose parameter of the active object and the second pose parameter of the driven object, where the active object is used to control the pose transformation of the driven object;
[0039] A first determination module configured to determine the transformation component of the driven object on the locked plane according to the first pose parameter and the second pose parameter, where the locked plane is determined based on the locked coordinate axis;
[0040] A second determination module configured to determine the locked rotation axis and rotation angle of the driven object according to the initial direction vector and transformation component of the driven object;
[0041] A control module configured to control the driven object to rotate the rotation angle along the locked rotation axis.
[0042] According to the third aspect of the embodiments of the present application, a computing device is provided, including:
[0043] A memory and a processor;
[0044] The memory is used to store computer-executable instructions, and when the processor executes the computer-executable instructions, the steps of the above object control method are implemented.
[0045] According to a fourth aspect of the embodiments of the present application, a computer-readable storage medium is provided, which stores computer-executable instructions, and when the instructions are executed by a processor, the steps of the above object control method are implemented.
[0046] The object control method provided by the present application can obtain the first pose parameter of the active object and the second pose parameter of the driven object, where the active object is used to control the pose transformation of the driven object; according to the first pose parameter and the second pose parameter, determine the transformation component of the driven object on the locking plane, where the locking plane is determined based on the locking coordinate axis; according to the initial direction vector of the driven object and the transformation component, determine the locking rotation axis and rotation angle of the driven object; control the driven object to rotate the rotation angle along the locking rotation axis.
[0047] In this case, the pose transformation of the driven object can be controlled by the pose transformation of the active object. When controlling the pose transformation of the driven object, the coordinate axis can be locked in advance, and the pose parameters of the driven object can be converted to the locking plane determined based on the locking coordinate axis to obtain the transformation component of the driven object on the locking plane. Based on the initial direction vector of the driven object itself and this transformation component, the locking rotation axis and rotation angle of the driven object can be determined, and then the driven object can be controlled to rotate the rotation angle along the locking rotation axis. In this way, according to the required transformation effect, the coordinate axis can be locked in advance, the pose parameters of the driven object can be converted, the locking rotation axis and rotation angle of the driven object can be determined, and the driven object can be controlled to rotate only along the determined locking rotation axis. For the dynamically changing local coordinates, the rotation dimension of a certain axis is avoided from being lost due to the superposition rotation of three axes, and the accuracy of controlling the pose transformation of the driven object is improved. Description of the Drawings
[0048] Figure 1 is a flowchart of an object control method provided by an embodiment of the present application;
[0049] Figure 2 is a schematic diagram of the control process of a driven object provided by an embodiment of the present application;
[0050] Figure 3 is a processing flowchart of an object control method applied to an animation production scenario provided by an embodiment of the present application;
[0051] Figure 4 is a schematic structural diagram of an object control device provided by an embodiment of the present application;
[0052] Figure 5 It is a structural block diagram of a computing device provided by an embodiment of the present application. Detailed implementation manners
[0053] In the following description, numerous specific details are set forth in order to provide a thorough understanding of the present application. However, the present application can be implemented in many other ways different from those described herein, and those skilled in the art can make similar generalizations without departing from the spirit of the present application. Therefore, the present application is not limited by the specific implementations disclosed below.
[0054] The terms used in one or more embodiments of the present application are for the purpose of describing specific embodiments only and are not intended to limit one or more embodiments of the present application. The singular forms "a", "said", and "the" used in one or more embodiments of the present application and the appended claims are also intended to include the plural forms unless the context clearly indicates otherwise. It should also be understood that the term "and / or" used in one or more embodiments of the present application refers to and includes any or all possible combinations of one or more of the associated listed items.
[0055] It should be understood that although the terms first, second, etc. may be used in one or more embodiments of the present application to describe various information, such information should not be limited to these terms. These terms are only used to distinguish information of the same type from each other. For example, without departing from the scope of one or more embodiments of the present application, the first may also be referred to as the second, and similarly, the second may also be referred to as the first.
[0056] In the present application, an object control method is provided. The present application is also related to an object control device, a computing device, and a computer-readable storage medium, which will be described in detail one by one in the following embodiments.
[0057] Figure 1 It is a flowchart of an object control method provided by an embodiment of the present application, which specifically includes the following steps:
[0058] Step 102: Obtain the first pose parameter of the active object and the second pose parameter of the driven object, where the active object is used to control the pose transformation of the driven object.
[0059] Specifically, an active object refers to an object whose pose parameters are configured by an object control platform, are not restricted by other objects, and can restrict the pose transformation of other objects. That is, the active object can act as a controller to restrict the pose transformation of a driven object. A driven object refers to an object whose pose transformation is restricted by an active object, that is, the driven object changes as the active object changes. Among them, the active object and the driven object can be two independent and complete individuals. For example, the active object is the animated character A, and the driven object is the animated character B; the active object is the animated character A, and the driven object is the related prop of the animated character A (such as props like a telescope, wings, etc.). Or, the active object and the driven object can also be two parts of a single entity. For example, the active object is the head of the animated character A, and the driven object is the tail of the animated character A.
[0060] It should be noted that the pose transformation of the driven object can be controlled based on the pose transformation of the active object. This pose transformation refers to a change in position and / or orientation, such as moving left, right, up, down, forward, backward, rotating, etc. Specifically, the first pose parameter of the active object refers to the pose parameter of the current pose of the active object, and the second pose parameter of the driven object refers to the pose parameter of the current pose of the driven object. Among them, the pose parameter can be a parameter that can represent position and orientation, such as coordinates in a three-dimensional coordinate system, rotation angle, etc.
[0061] In practical applications, the object control platform can be configured with various pose parameters of the active object during the pose transformation process, as well as the constraint relationship between the pose parameters of the active object and the driven object. That is, when the active object undergoes a certain pose transformation, the driven object undergoes a corresponding transformation. For example, the object control platform can control the driven object to look at the active object along the longitudinal axis. When specifically implemented, when controlling the driven object to transform, the first pose parameter of the current pose of the active object and the second pose parameter of the current pose of the driven object can be obtained first, so as to transform the pose of the driven object based on the second pose parameter.
[0062] In an optional implementation manner of this embodiment, in the animation production scenario, the active object is the control bone in the current animation frame, and the driven object is the constrained bone in the current animation frame.
[0063] It should be noted that bone animation is a type of model animation. Currently, there are two ways of model animation: vertex animation and bone animation. In bone animation, the model has a skeleton structure composed of interconnected "bones", and animations are generated for the model by changing the orientation and position of the bones. In the bone animation scenario, various pose parameters of the control bone are pre-configured by the art designers in the animation production platform. Based on the pose transformation of the control bone, the pose transformation of the constrained bone is controlled, so as to obtain the completed animation frame to generate an animation.
[0064] In the embodiments of the present application, in an animation scene, the transformation of the constrained bones can be controlled by controlling the bones, which improves the flexibility of animation production and thus can improve the animation effect.
[0065] In an optional implementation manner of this embodiment, a driven object can be controlled by one active object, or the same driven object can be controlled by multiple active objects, that is, the number of active objects is at least two. At this time, before obtaining the first pose parameter of the active object, the following steps may further be included:
[0066] Obtain the control order of at least two active objects;
[0067] Determine a target active object from the at least two active objects according to the control order, where the target active object is the active object that currently controls the pose transformation of the driven object;
[0068] Correspondingly, the obtaining of the first pose parameter of the active object includes:
[0069] Obtain the first pose parameter of the target active object.
[0070] It should be noted that at least two active objects may have different control orders for the driven object. Starting from the first active object, the driven object is controlled to update the second pose parameter of the driven object until the driven object with the transformation completed is obtained based on the last active object.
[0071] In practical applications, when the number of active objects capable of controlling the driven object is at least two, the control order of at least two active objects can be obtained, and this control order is the order pre-configured by the object control platform. Then, a target active object is determined from the at least two active objects according to this control order, that is, the active object that currently controls the pose transformation of the driven object, and the first pose parameter of this target active object is obtained. Subsequently, the driven object can be controlled in combination with the second pose parameter of the driven object.
[0072] When specifically implemented, when determining the target active object from the at least two active objects according to the control order, the first active object in the control order can be used as the target active object first, the first pose parameter of the target active object is obtained to control the driven object, and then each subsequent active object is used as the target active object in turn to realize the control of the driven object.
[0073] Exemplarily, the driven object is the wing of the animated character A, and the driving objects are the head, both hands, and both feet of the animated character A. That is, the head, both hands, and both feet of the animated character A can all constrain the pose transformation of the wing of the animated character A. Assuming that the control order of each driving object is the head, both hands, and both feet in sequence, then first take the head of the animated character A as the target driving object, obtain the first pose parameter of the head of the animated character A and the second pose parameter of the wing of the animated character A. Subsequently, the wing of the animated character A can be controlled to transform based on the first pose parameter and the second pose parameter. Then, take the both hands and both feet of the animated character A as the target driving objects in sequence to transform the wing of the animated character A.
[0074] In the embodiments of the present application, the same driven object can be controlled by multiple driving objects, and each driving object can be pre-set with a control order for the driven object. Based on this control order, the driven object is controlled based on each driving object in sequence. The control of each driving object on the driven object can be implemented through multi-threading, supporting multi-constraint superposition and multi-threading, improving the control accuracy of the driven object, and improving the control effect and optimizing the calculation efficiency.
[0075] Step 104: Determine the transformation component of the driven object on the locking plane according to the first pose parameter and the second pose parameter, where the locking plane is determined based on the locking coordinate axis.
[0076] Specifically, the locking coordinate axis refers to the fixed coordinate axis in the coordinate system created based on the driven object. That is, subsequently, the rotation of the driven object is controlled only based on this locking coordinate axis, and this locking coordinate axis is pre-set by the staff based on the desired transformation effect. The locking plane refers to the plane to which the pose parameters of the driven object need to be converted. That is, this locking plane can be the projection plane of the locking coordinate axis, and this locking plane is determined based on the locking coordinate axis.
[0077] In practical applications, the object control platform can directly read the pre-configured locking coordinate axis, then determine the locking plane based on the locking coordinate axis, and then determine the transformation component of the driven object on the locking plane according to the first pose parameter and the second pose parameter. Among them, this transformation component is the parameter component of the second pose parameter of the driven object converted to the locking plane.
[0078] In the embodiments of the present application, after obtaining the first pose parameter of the driving object and the second pose parameter of the driven object, the transformation component of the driven object on the locking plane can be determined according to the first pose parameter and the second pose parameter. Thus, the coordinate axis can be pre-locked according to the desired transformation effect to convert the pose parameters of the driven object, facilitating subsequent control of the rotation of the driven object based on the locking coordinate axis and improving the accuracy of controlling the pose transformation of the driven object.
[0079] In an alternative implementation of this embodiment, after the object control platform reads the pre-configured locked coordinate axes, it can determine the locked plane based on the locked coordinate axes, and then convert the pose parameters of the driven object. That is, before determining the transformation components of the driven object on the locked plane according to the first pose parameter and the second pose parameter, it may further include:
[0080] Determine the projection coordinate axes in the target coordinate system other than the locked coordinate axes, where the target coordinate system is a coordinate system established based on the driven object;
[0081] Take the plane formed by the projection coordinate axes as the locked plane.
[0082] It should be noted that the target coordinate system refers to a coordinate system established based on the driven object, and the locked coordinate axis is a certain coordinate axis in the target coordinate system. After the object control platform reads the locked coordinate axis, it can determine the projection coordinate axes in the target coordinate system other than the locked coordinate axis, and take the plane formed by the projection coordinate axes as the locked plane.
[0083] For example, assume that the target coordinate system is a three-dimensional coordinate system, that is, it includes three coordinate axes such as the X-axis, Y-axis, and Z-axis. Assume that the locked coordinate axis is the Z-axis. Then at this time, the projection coordinate axes are the X-axis and Y-axis, and the locked plane is the plane formed by the X-axis and Y-axis. Subsequently, the second pose parameter of the driven object can be projected and converted onto the plane formed by the X-axis and Y-axis, thereby locking the Z-axis and enabling the driven object to rotate based on the Z-axis.
[0084] In the embodiment of the present application, it is possible to determine the projection coordinate axes in the target coordinate system established based on the driven object other than the locked coordinate axes, and take the plane formed by the projection coordinate axes as the locked plane. In this way, based on the pre-set locked coordinate axes, the locked plane can be determined, so that the coordinate axes can be locked in advance according to the required transformation effect, and the pose parameters of the driven object can be converted, which is convenient for subsequently controlling the driven object to rotate based on the locked coordinate axes and improving the accuracy of controlling the pose transformation of the driven object.
[0085] In an alternative implementation of this embodiment, the second pose parameter of the driven object can be converted onto the locked plane by projection, that is, according to the first pose parameter and the second pose parameter, determine the transformation components of the driven object on the locked plane. The specific implementation process can be as follows:
[0086] According to the first pose parameter and the second pose parameter, determine the constraint vector of the driven object towards the active object;
[0087] According to the first pose parameter and the second pose parameter, determine the projection vector of the constraint vector on the locked plane;
[0088] Use the projection vector as the transformation component of the driven object on the locking plane.
[0089] Specifically, the constraint vector refers to the vector between the driven object and the driving object, and the vector direction is from the driven object towards the driving object. The projection vector is the projection of the constraint vector on the locking plane.
[0090] In practical applications, when determining the constraint vector of the driven object towards the driving object according to the first pose parameter and the second pose parameter, the first coordinate of the driving object can be obtained from the first pose parameter, the second coordinate of the driven object can be obtained from the second pose parameter, and the first coordinate is subtracted from the second coordinate to obtain the constraint vector of the driven object towards the driving object.
[0091] In addition, when determining the projection vector of the constraint vector on the locking plane according to the first pose parameter and the second pose parameter, a vertical vector perpendicular to the locking plane can be determined based on the constraint vector, the intersection coordinate of the vertical vector and the locking plane can be determined, and the projection vector of the constraint vector on the locking plane is from the origin of the target coordinate system to this intersection coordinate. This projection vector is used as the transformation component of the driven object on the locking plane.
[0092] Exemplarily, Figure 2 is a schematic diagram of the control process of a driven object provided by an embodiment of the present application. As Figure 2 shown, the driving object is M, the driven object is O, and it is assumed that the locking coordinate axis is the Z axis. At this time, the coordinates (x o , y o , z o ) of the driven object O and the coordinates (x m , y m , z m ) of the driving object M can be obtained first, and the constraint vector OM=(x m -x o , y m -y o , z m -z o ) of the driven object O towards the driving object M can be determined. Then, the projection vector OM'(x m -x o , y m -y o , 0) of the constraint vector OM on the locking plane (XY plane) formed by the X axis and the Y axis is determined. This projection vector OM'(x m -x o , y m -y o , 0) is the transformation component of the driven object on the locking plane.
[0093] In the embodiments of the present application, first, a constraint vector of the driven object facing the active object may be determined according to the first pose parameter and the second pose parameter. Then, a projection vector of the constraint vector on the locking plane may be determined according to the first pose parameter and the second pose parameter, and this projection vector is used as the transformation component of the driven object on the locking plane. In this way, the coordinate axes can be locked in advance according to the required transformation effect, and the pose parameters of the driven object can be converted. Subsequently, the driven object can be controlled to rotate based on the locked coordinate axes. For the dynamically changing local coordinates, the rotation dimension of a certain axis caused by the superposition rotation of the three axes is avoided, and the accuracy of controlling the pose transformation of the driven object is improved.
[0094] Step 106: Determine the locking rotation axis and rotation angle of the driven object according to the initial direction vector and the transformation component of the driven object.
[0095] It should be noted that the initial direction vector of the driven object refers to the current orientation of the driven object before rotation, and this initial direction vector is the direction in which the driven object looks at the active object (i.e., the aiming direction); the transformation component is the parameter obtained by converting the pose parameters of the driven object onto the locking plane. Based on this initial direction vector and the transformation component, the locking rotation axis and rotation angle of the driven object can be determined. This locking rotation axis is the direction in which the driven object rotates, and this rotation angle is the angle of rotation along the locked coordinate axis.
[0096] In practical applications, the driven object is often not a point but an object with a certain length. Therefore, the starting point coordinates of the driven object can be determined, and according to these starting point coordinates, the initial direction vector of the driven object can be determined.
[0097] Continuing with the above example, as Figure 2 shown, assume that the driven object looks at the active object M along the Y axis (i.e., the aiming axis is the Y axis, that is, the initial direction vector of the driven object is in the Y axis direction). Assume that point O is the starting point of the driven object, with coordinates (x o , y o , z o ), and point A is the end point of the driven object, with coordinates (x a , y a , z a ). Therefore, the initial direction vector OA of the driven object = (x a - x o , y a - y o , z a - z o ).
[0098] In an alternative implementation manner of this embodiment, to determine the locking rotation axis and rotation angle of the driven object according to the initial direction vector and the transformation component of the driven object, the specific implementation process may be as follows:
[0099] Determine a perpendicular vector that is perpendicular to both the initial direction vector and the transformation component, and use this perpendicular vector as the locked rotation axis;
[0100] Determine the vector angle between the transformation component and the initial direction vector, and use this vector angle as the rotation angle.
[0101] It should be noted that the initial direction vector is the initial orientation of the driven object, and the transformation component is the transformation parameter obtained based on the conversion of the locked coordinate axes. By determining a perpendicular vector that is perpendicular to both the initial direction vector and the transformation component, this perpendicular vector is the locked rotation axis, that is, the rotation axis for controlling the rotation of the driven object. Specifically, in implementation, the cross product calculation can be performed on the initial direction vector and the transformation component to obtain the vector outer product of the initial direction vector and the transformation component. This vector outer product is perpendicular to both the initial direction vector and the transformation component, that is, the perpendicular vector, and subsequently the driven object rotates along this direction.
[0102] In addition, to control the driven object to rotate from the current initial orientation to face the active object, in addition to determining the locked rotation axis for rotation, it is also necessary to determine the rotation angle along the locked rotation axis. Therefore, the vector angle between the transformation component and the initial direction vector can be determined, and this vector angle is used as the rotation angle.
[0103] In the embodiments of the present application, the initial direction vector is the initial orientation of the driven object, and the transformation component is obtained by projecting the constraint vector onto the locked plane, that is, the transformation component is the parameter after the conversion of the driven object. Therefore, a perpendicular vector that is perpendicular to both the initial direction vector and the transformation component can be determined as the locked rotation axis, and the vector angle between the transformation component and the initial direction vector is determined, and the vector angle is used as the rotation angle, which is convenient for subsequently controlling the driven object to rotate by the corresponding angle along the calculated locked rotation axis. For the dynamically transformed local coordinates, it avoids the loss of the rotation dimension of a certain axis due to the superposition rotation of the three axes, and improves the accuracy of controlling the pose transformation of the driven object.
[0104] In an optional implementation manner of this embodiment, the vector angle between the two vectors can be determined based on the vector lengths and the vector inner product of the transformation component and the initial direction vector, that is, the vector angle between the transformation component and the initial direction vector is determined. The specific implementation process can be as follows:
[0105] Determine the vector inner product between the transformation component and the initial direction vector;
[0106] Determine the first vector length of the transformation component and the second vector length of the initial direction vector;
[0107] Determine the vector angle between the transformation component and the initial direction vector according to the vector inner product, the first vector length, and the second vector length.
[0108] It should be noted that the dot product can be performed on the transformation component and the initial direction vector to obtain the vector inner product between the transformation component and the initial direction vector. Then, based on the vector coordinates of the transformation component, the first vector length of the transformation component is determined, and based on the vector coordinates of the initial direction vector, the second vector length of the initial direction vector is determined. Then, the cosine value of the vector angle between the transformation component and the initial direction vector is obtained by dividing the vector inner product by the product of the first vector length and the second vector length. Then, the vector angle is further determined based on this cosine value.
[0109] In practical applications, the cosine value of the vector angle between the transformation component and the initial direction vector can be determined through the following formula (1):
[0110]
[0111] where OA is the initial direction vector, OM′ is the transformation component, and θ is the vector angle between the transformation component and the initial direction vector.
[0112] Continuing with the above example, as Figure 2 shown, according to the initial direction vector OA and the transformation component OM′, determine the vector angle θ between the transformation component and the initial direction vector, and this vector angle θ is the rotation angle θ.
[0113] In the embodiments of the present application, the cosine value of the vector angle between the two vectors can be determined first based on the vector lengths and the vector inner product of the transformation component and the initial direction vector, and then the vector angle between the transformation component and the initial direction vector can be determined, which is used as the rotation angle of the driven object along the locked rotation axis, facilitating subsequent control of the driven object to rotate by the corresponding angle along the locked rotation axis.
[0114] Step 108: Control the driven object to rotate by this rotation angle along the locked rotation axis.
[0115] It should be noted that the locked coordinate axis is pre-locked, that is, the projection plane is locked, and the pose parameters of the driven object are projected onto the locked plane, thereby determining the locked rotation axis and the rotation angle of the driven object. Therefore, at this time, the driven object can be controlled to rotate by this rotation angle along the calculated locked rotation axis, so that the pose parameters of the driven object can be converted according to the required transformation effect, and the driven object can be controlled to rotate only along the calculated locked rotation axis. For the dynamically transformed local coordinates, the rotation dimension of a certain axis is avoided from being lost due to the superposition of three-axis rotations, improving the accuracy of controlling the pose transformation of the driven object.
[0116] In an alternative embodiment of this example, after determining the locked rotation axis and the rotation angle, a corresponding control weight can be set for each rotation. According to this control weight, the driven object is controlled to rotate along the locked rotation axis, that is, the driven object is controlled to rotate the rotation angle along the locked rotation axis. The specific implementation process can be as follows:
[0117] Obtain the control weight of the active object over the driven object;
[0118] Determine the target rotation angle of the driven object according to the control weight;
[0119] Control the driven object to rotate the target rotation angle along the locked rotation axis.
[0120] It should be noted that the control weight refers to the control coefficient of the active object over the driven object, that is, the weight coefficient of the driven object based on the rotation of this active object. Different active objects can be set with different control weights. Among them, this control weight can be set to any value between 0 and 1.
[0121] In practical applications, the object control platform can display an object control interface. This object control interface can set various parameters in the control process of the driven object, that is, provide a parameter setting area. The control weight of the current rotation of the active object can be set in the weight setting box in the parameter setting area.
[0122] Continuing with the above example, as Figure 2 shown, the control weight of the current rotation can be set in the weight setting box in the parameter setting area. Assume that the control weight is set to 0.5 and the determined rotation angle is 30 degrees. At this time, control the driven object to rotate 15 degrees along the Z axis, and then continue the next rotation. Or, assume that the control weight is set to 1 and the determined rotation angle is 30 degrees. At this time, control the driven object to rotate 30 degrees along the Z axis, and then continue the next rotation.
[0123] In the embodiments of this application, the control weight of the active object over the driven object can be set. Different active objects can be set with different control weights. Then, according to this control weight, the target rotation angle of the driven object is determined, and the driven object is controlled to rotate this target rotation angle along the locked rotation axis. In this way, according to the requirements in practical applications, the control weight of the active object over the driven object can be set to achieve personalized control of different active objects, and improve the accuracy and effect of object control.
[0124] In an alternative implementation of this embodiment, when there are multiple active objects, after controlling the driven object to rotate based on the current active object, the driven object can continue to be controlled to rotate based on the next active object. That is, after controlling the driven object to rotate the rotation angle along the locked rotation axis, the following steps may further be included:
[0125] Determine the next active object of the target active object according to the control order;
[0126] Use the next active object as the target active object.
[0127] It should be noted that the first active object in the control order can be used as the target active object first, and the first pose parameter of the target active object can be obtained. Then, the driven object can be controlled to rotate along the locked rotation axis. After the rotation is completed, the next active object of the target active object can be determined, and the driven object can continue to be controlled to rotate along the locked rotation axis based on the next active object until the last active object is determined. In this way, based on this control order, the driven object can be controlled based on each active object in turn. The control of the driven object by each active object can be implemented through multithreading, supporting multi-constraint superposition and multithreading, improving the control accuracy of the driven object, enhancing the control effect, and optimizing the calculation efficiency.
[0128] The object control method provided by this application can control the pose transformation of the driven object through the pose transformation of the active object. When controlling the pose transformation of the driven object, the coordinate axes can be locked in advance, and the pose parameters of the driven object can be converted to the locked plane determined based on the locked coordinate axes to obtain the transformation components of the driven object on the locked plane. Based on the initial direction vector of the driven object itself and these transformation components, the locked rotation axis and rotation angle of the driven object can be determined, and then the driven object can be controlled to rotate the rotation angle along the locked rotation axis. In this way, according to the required transformation effect, the coordinate axes can be locked in advance, the pose parameters of the driven object can be converted, the locked rotation axis and rotation angle of the driven object can be determined, and the driven object can be controlled to rotate only along the determined locked rotation axis. For the dynamically changing local coordinates, the rotation dimension of a certain axis caused by the loss of the three-axis superposition rotation is avoided, and the accuracy of controlling the pose transformation of the driven object is improved.
[0129] The following combines the append Figure 3 Taking the application of the object control method provided by this application in the animation production scenario as an example, the object control method will be further described. Among them, Figure 3 FIG. shows a processing flow chart of an object control method provided by an embodiment of this application applied to an animation production scenario. Applied to an animation production platform, it specifically includes the following steps:
[0130] Step 302: Obtain the control order of at least two control bones, and determine the target control bone from the at least two control bones according to this control order.
[0131] Step 304: Obtain the first pose parameter of the target control bone and the second pose parameter of the constraint bone.
[0132] Among them, the target control bone is the bone for the pose transformation of the current control constraint bone.
[0133] Step 306: Determine the projection coordinate axes except the locked coordinate axes in the target coordinate system established based on the constraint bone, and use the plane formed by the projection coordinate axes as the projection plane.
[0134] Step 308: Determine the constraint vector of the constraint bone towards the target control bone according to the first pose parameter and the second pose parameter.
[0135] Step 310: Determine the projection vector of the constraint vector on the projection plane according to the first pose parameter and the second pose parameter, and use the projection vector as the transformation component of the constraint bone on the projection plane.
[0136] Step 312: Determine the initial direction vector of the driven object, and determine the vertical vector that is perpendicular to both the initial direction vector and the transformation component, and use the vertical vector as the locked rotation axis; determine the vector angle between the transformation component and the initial direction vector, and use this vector angle as the rotation angle.
[0137] Step 314: Obtain the control weight of the target control bone on the constraint bone, and determine the target rotation angle of the constraint bone according to this control weight, and control the constraint bone to rotate by this target rotation angle along the locked rotation axis.
[0138] Step 316: Determine the next control bone of the target control bone according to this control order, and use the next control bone as the target control bone.
[0139] In practical applications, after executing Step 316, the operation of Step 304 can be returned to be executed until the target control bone is the last control bone among the at least two control bones, and the current animation frame is obtained.
[0140] The object control method provided by this application can control the pose transformation of a driven object through the pose transformation of an active object. When controlling the pose transformation of the driven object, the coordinate axes can be locked in advance, and the pose parameters of the driven object can be converted to a locked plane determined based on the locked coordinate axes to obtain the transformation components of the driven object on the locked plane. Based on the initial direction vector of the driven object itself and these transformation components, the locked rotation axis and rotation angle of the driven object can be determined, and then the driven object can be controlled to rotate by this rotation angle along the locked rotation axis. In this way, according to the required transformation effect, the coordinate axes can be locked in advance, the pose parameters of the driven object can be converted, the locked rotation axis and rotation angle of the driven object can be determined, and the driven object can be controlled to rotate only along the determined locked rotation axis. For the dynamically changing local coordinates, the loss of the rotation dimension of a certain axis caused by the superposition rotation of three axes is avoided, and the accuracy of controlling the pose transformation of the driven object is improved.
[0141] Corresponding to the above method embodiment, this application also provides an embodiment of an object control device. Figure 4 The structural schematic diagram of an object control device provided by an embodiment of this application is shown. As Figure 4 shown, this device includes:
[0142] An acquisition module 402, configured to acquire the first pose parameter of the active object and the second pose parameter of the driven object, where the active object is used to control the pose transformation of the driven object;
[0143] A first determination module 404, configured to determine the transformation components of the driven object on the locked plane according to the first pose parameter and the second pose parameter, where the locked plane is determined based on the locked coordinate axes;
[0144] A second determination module 406, configured to determine the locked rotation axis and rotation angle of the driven object according to the initial direction vector of the driven object and the transformation components;
[0145] A control module 408, configured to control the driven object to rotate by this rotation angle along the locked rotation axis.
[0146] Optionally, the first determination module 404 is further configured to:
[0147] Determine the constraint vector of the driven object facing the active object according to the first pose parameter and the second pose parameter;
[0148] Determine the projection vector of the constraint vector on the locked plane according to the first pose parameter and the second pose parameter;
[0149] Use the projection vector as the transformation components of the driven object on the locked plane.
[0150] Optionally, the second determination module 406 is further configured to:
[0151] Determine a vertical vector that is perpendicular to both the initial direction vector and the transformation component, and use the vertical vector as the locked rotation axis;
[0152] Determine the vector angle between the transformation component and the initial direction vector, and use the vector angle as the rotation angle.
[0153] Optionally, the second determination module 406 is further configured to:
[0154] Determine the vector inner product between the transformation component and the initial direction vector;
[0155] Determine the first vector length of the transformation component and the second vector length of the initial direction vector;
[0156] Determine the vector angle between the transformation component and the initial direction vector according to the vector inner product, the first vector length, and the second vector length.
[0157] Optionally, the device further includes a third determination module, configured to:
[0158] Determine the projection coordinate axes in the target coordinate system other than the locked coordinate axes, where the target coordinate system is a coordinate system established based on the driven object;
[0159] Use the plane formed by the projection coordinate axes as the locked plane.
[0160] Optionally, the control module 408 is further configured to:
[0161] Obtain the control weight of the active object on the driven object;
[0162] Determine the target rotation angle of the driven object according to the control weight;
[0163] Control the driven object to rotate by the target rotation angle along the locked rotation axis.
[0164] Optionally, the device further includes a fourth determination module, configured to:
[0165] Obtain the control order of at least two active objects;
[0166] Determine a target active object from the at least two active objects according to the control order, where the target active object is the active object that currently controls the pose transformation of the driven object;
[0167] Correspondingly, the obtaining module 402 is further configured to:
[0168] Obtain the first pose parameter of the target active object.
[0169] Optionally, the fourth determining module is further configured to:
[0170] Determine the next active object of the target active object according to the control sequence;
[0171] Use the next active object as the target active object.
[0172] Optionally, the active object is the control bone in the current animation frame, and the passive object is the constrained bone in the current animation frame.
[0173] The object control device provided by this application can control the pose transformation of the passive object through the pose transformation of the active object. When controlling the pose transformation of the passive object, the coordinate axes can be locked in advance, and the pose parameters of the passive object can be converted to the locked plane determined based on the locked coordinate axes to obtain the transformation components of the passive object on the locked plane. Based on the initial direction vector of the passive object itself and this transformation component, the locked rotation axis and rotation angle of the passive object can be determined, and then the passive object can be controlled to rotate by this rotation angle along the locked rotation axis. In this way, according to the required transformation effect, the coordinate axes can be locked in advance, the pose parameters of the passive object can be converted, the locked rotation axis and rotation angle of the passive object can be determined, and the passive object can be controlled to rotate only along the determined locked rotation axis. For the dynamically changing local coordinates, the rotation dimension of a certain axis is avoided from being lost due to the superposition rotation of three axes, and the accuracy of controlling the pose transformation of the passive object is improved.
[0174] The above is a schematic solution of an object control device in this embodiment. It should be noted that the technical solution of this object control device and the technical solution of the above object control method belong to the same concept. For the details not described in detail in the technical solution of the object control device, reference can be made to the description of the technical solution of the above object control method. In addition, each component in the device embodiment should be understood as a functional module that must be established to implement each step of the program flow or each step of the method. Each functional module is not an actual functional division or separation limitation. The device claims defined by such a set of functional modules should be understood as a functional module framework that mainly realizes the solution through the computer program recorded in the specification, rather than an entity device that mainly realizes the solution through hardware means.
[0175] Figure 5The block diagram of a computing device according to an embodiment of the present application is shown. The components of the computing device 500 include, but are not limited to, a memory 510 and a processor 520. The processor 520 is connected to the memory 510 via a bus 530, and a database 550 is used to store data.
[0176] The computing device 500 further includes an access device 540, which enables the computing device 500 to communicate via one or more networks 560. Examples of these networks include the Public Switched Telephone Network (PSTN), Local Area Network (LAN), Wide Area Network (WAN), Personal Area Network (PAN), or a combination of communication networks such as the Internet. The access device 540 may include one or more of any type of wired or wireless network interfaces (e.g., a Network Interface Controller (NIC)), 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, a Near Field Communication (NFC) interface, and so on.
[0177] In an embodiment of the present application, the above components of the computing device 500 and Figure 5 other components not shown may also be connected to each other, e.g., via a bus. It should be understood that Figure 5 the shown block diagram of the computing device is for illustrative purposes only and is not a limitation on the scope of the present application. Those skilled in the art can add or replace other components as needed.
[0178] The computing device 500 can 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 smartphone), 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 PC. The computing device 500 can also be a mobile or stationary server.
[0179] Among them, when the processor 520 executes the computer-executable instructions, the steps of the above-mentioned object control method are implemented.
[0180] The above is a schematic solution of a computing device according to this embodiment. It should be noted that the technical solution of this computing device and the technical solution of the above-mentioned object control method belong to the same concept. For the details not described in detail in the technical solution of the computing device, reference can be made to the description of the technical solution of the above-mentioned object control method.
[0181] An embodiment of the present application further provides a computer-readable storage medium, which stores computer instructions. When the instructions are executed by a processor, the steps of the above-mentioned object control method are implemented.
[0182] The above is a schematic solution of a computer-readable storage medium according to this embodiment. It should be noted that the technical solution of this storage medium and the technical solution of the above-mentioned object control method belong to the same concept. For the details not described in detail in the technical solution of the storage medium, reference can be made to the description of the technical solution of the above-mentioned object control method.
[0183] The computer instructions include computer program codes, and the computer program codes can be in the form of source code, object code, executable files or some intermediate forms, etc. The computer-readable medium can include: any entity or device capable of carrying the computer program code, recording medium, USB flash drive, mobile hard disk, magnetic disk, optical disc, computer memory, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), electrical carrier signals, telecommunication signals, and software distribution media, etc.
[0184] It should be noted that for the foregoing method embodiments, for the sake of simplicity of description, they are all expressed as a series of action combinations. However, those skilled in the art should know that the present application is not limited by the described action sequence, because according to the present application, certain steps can be performed in other sequences or simultaneously. Secondly, those skilled in the art should also know that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily essential to the present application.
[0185] In the above embodiments, the descriptions of the respective embodiments have their own emphases. For the parts not detailed in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0186] The preferred embodiments of the present application disclosed above are only used to help explain the present application. The alternative embodiments do not describe all the details in detail, nor do they limit the invention to the specific embodiments described. Obviously, many modifications and variations can be made according to the content of the present application. These embodiments are selected and specifically described in the present application to better explain the principles and practical applications of the present application, so that those skilled in the art can well understand and utilize the present application. The present application is only limited by the claims and their full scope and equivalents.
Claims
1. An object control method, characterized in that, Including: Obtain the first pose parameter of the active object and the second pose parameter of the driven object, where the active object is used to control the pose transformation of the driven object; Determine the transformation component of the driven object on the locking plane according to the first pose parameter and the second pose parameter, where the locking plane is a projection plane determined based on the locking coordinate axis, and the locking coordinate axis refers to the fixed coordinate axis in the coordinate system created based on the driven object; Determine the locking rotation axis and rotation angle of the driven object according to the initial direction vector of the driven object and the transformation component; Control the driven object to rotate by the rotation angle along the locking rotation axis.
2. The object control method according to claim 1, wherein The determining the transformation component of the driven object on the locking plane according to the first pose parameter and the second pose parameter includes: Determine the constraint vector of the driven object towards the active object according to the first pose parameter and the second pose parameter; Determine the projection vector of the constraint vector on the locking plane according to the first pose parameter and the second pose parameter; Take the projection vector as the transformation component of the driven object on the locking plane.
3. The object control method according to claim 2, wherein The determining the locking rotation axis and rotation angle of the driven object according to the initial direction vector of the driven object and the transformation component includes: Determine a perpendicular vector that is perpendicular to both the initial direction vector and the transformation component, and take the perpendicular vector as the locking rotation axis; Determine the vector angle between the transformation component and the initial direction vector, and take the vector angle as the rotation angle.
4. The object control method according to claim 3, characterized in that, The determining the vector angle between the transformation component and the initial direction vector includes: Determine the vector inner product between the transformation component and the initial direction vector; Determine the first vector length of the transformation component and the second vector length of the initial direction vector; Determine the vector angle between the transformation component and the initial direction vector according to the vector inner product, the first vector length and the second vector length.
5. The object control method according to any one of claims 1-4, characterized in that, Before the determining the transformation component of the driven object on the locking plane according to the first pose parameter and the second pose parameter, it further includes: Determine the projection coordinate axis in the target coordinate system other than the locking coordinate axis, where the target coordinate system is a coordinate system established based on the driven object; Take the plane formed by the projection coordinate axes as the locking plane.
6. The object control method according to any one of claims 1-4, characterized in that The controlling the driven object to rotate by the rotation angle along the locking rotation axis includes: Obtain the control weight of the active object on the driven object; Determine the target rotation angle of the driven object according to the control weight; Control the driven object to rotate by the target rotation angle along the locking rotation axis.
7. The object control method according to any one of claims 1-4, characterized in that, There are at least two active objects; before obtaining the first pose parameter of the active object, it further includes: Obtain the control order of at least two active objects; Determine the target active object from the at least two active objects according to the control order, where the target active object is the active object that currently controls the pose transformation of the driven object; Correspondingly, obtaining the first pose parameter of the active object includes: Obtaining the first pose parameter of the target active object.
8. The object control method according to claim 7, characterized in that After controlling the driven object to rotate by the rotation angle along the locked rotation axis, it further includes: Determining the next active object of the target active object according to the control sequence; Taking the next active object as the target active object.
9. The object control method according to any one of claims 1-4, characterized in that, The active object is the control bone in the current animation frame, and the driven object is the constrained bone in the current animation frame.
10. An object control device, characterized in that, It includes: An obtaining module, configured to obtain the first pose parameter of the active object and the second pose parameter of the driven object, where the active object is used to control the pose transformation of the driven object; A first determination module, configured to determine the transformation component of the driven object on the locked plane according to the first pose parameter and the second pose parameter, where the locked plane is a projection plane determined based on the locked coordinate axis, and the locked coordinate axis refers to the fixed coordinate axis in the coordinate system created based on the driven object; A second determination module, configured to determine the locked rotation axis and the rotation angle of the driven object according to the initial direction vector of the driven object and the transformation component; A control module, configured to control the driven object to rotate by the rotation angle along the locked rotation axis.
11. A computing device, characterized in that, It includes: A memory and a processor; The memory is used to store computer-executable instructions, and the processor is used to execute the computer-executable instructions to implement the steps of the object control method according to any one of claims 1 to 9.
12. A computer-readable storage medium storing computer instructions, characterized in that, When the instruction is executed by the processor, it implements the steps of the object control method according to any one of claims 1 to 9.
13. A computer program product, characterized in that, It includes computer instructions, and when the computer instructions are executed by the processor, it implements the steps of the object control method according to any one of claims 1 to 9.
Citation Information
Patent Citations
Method and device for determining working pose of mechanical arm
CN113768640A
Laparoscopic holding robot control method based on poses of laparoscopic surgical instruments
CN114366313A