Program, game device, and character control method
A three-bone structure with fixed joint angles and controlled bone lengths addresses high computational loads in character control, enabling efficient and expressive virtual character movements.
Patent Information
- Application Number
- JP2023034466
- Authority / Receiving Office
- JP · JP
- Patent Type
- Applications
- Current Assignee / Owner
- Filing Date
- 2023-03-07
- Publication Date
- 2024-09-20
- Estimated Expiration
- 2043-03-07
AI Technical Summary
Conventional methods for controlling character movements in virtual spaces using three-link structures with inverse kinematics require high computational loads, especially when multiple characters are involved.
A character control method utilizing a three-bone structure with fixed joint angles and controlled bone lengths to calculate joint movements, reducing computational load through simplified angle calculations.
Enables expressive character movements with reduced computational requirements, allowing for efficient rendering of character actions in virtual environments.
Smart Images

Figure 2024126224000001
Abstract
Description
[Technical field]
[0001] The present invention relates to a program, a game device, and a character control method. [Background technology]
[0002] 2. Description of the Related Art There is known a system for moving a virtual character placed in a virtual space based on motion data (for example, see Patent Document 1). [Prior art documents] [Patent documents]
[0003] [Patent Document 1] JP 2021-43611 A Summary of the Invention [Problem to be solved by the invention]
[0004] By making a character's arms and legs a three-link structure consisting of three bones and two joints, it is possible to bend the arms and legs beautifully. When applying IK (Inverse Kinematics), which calculates the angle of each joint from the target position of the tip of the arm or leg, to such a three-link structure, traditionally a method called CCD-IK or the Jacobi method, which requires repeated calculations, was used, which resulted in a high calculation load, especially when moving multiple characters.
[0005] The present invention has been made in consideration of the above-mentioned problems, and its object is to provide a program, a game device, and a character control method that are capable of expressing character movements with a small computational load. [Means for solving the problem]
[0006] (1) The present invention is a program for causing a character placed in a virtual space to execute a given action, the character having a first bone, a second bone, and a third bone having a predetermined length, a first joint portion connecting the first bone and the second bone, and a second joint portion connecting the second bone and the third bone, the program including a placement unit for placing the character in the virtual space, and an angle θ of the first joint portion. a and the angle θ of the second joint b and causes a computer to function as a control unit that controls the movement of the joints accompanying the action of the character, and the control unit controls the first bone, the second bone, and the third bone to move on approximately the same plane, and calculates the angle θ based on a distance d between a tip of the first bone and a tip of the third bone, a length L1 of the first bone, a length L2 of the second bone, and a length L3 of the third bone. a and the angle θ b The present invention also relates to a computer-readable information storage medium storing the program. The present invention also relates to a game device including the above-mentioned sections.
[0007] The present invention also provides a character control method for causing a character placed in a virtual space to execute a given action, the character having a first bone, a second bone, and a third bone having a predetermined length, a first joint portion connecting the first bone and the second bone, and a second joint portion connecting the second bone and the third bone, the method including a placement step of placing the character in the virtual space, and an angle θ of the first joint portion. a and the angle θ of the second joint b and a control step of controlling a movement of the joint accompanying a motion of the character, in which the control step controls the first bone, the second bone, and the third bone to move on approximately the same plane, and calculates the angle θ based on a distance d between a tip of the first bone and a tip of the third bone, a length L1 of the first bone, a length L2 of the second bone, and a length L3 of the third bone. a and the angle θ b The present invention relates to a character control method, comprising the steps of:
[0008] According to the present invention, the θ of each joint is calculated based on the distance d between the tip of the first bone and the tip of the third bone and the lengths L1, L2, and L3 of each bone. a ,θ b By calculating the above, the character's movements can be expressed with a small computational load.
[0009] (2) In the program, information storage medium, game device, and character control method according to the present invention, the angle θ a and the angle θ b may be equal.
[0010] (3) In the program, the information storage medium, the game device, and the character control method according to the present invention, the control unit (in the control step) determines the angle θ a and the angle θ b , as follows:
number
[0011] (4) Furthermore, in the program, information storage medium, game device, and character control method of the present invention, the control unit (in the control step) may add a correction value to any of the lengths L1, L2, L3 when a specified game event occurs.
[0012] (5) In the program, information storage medium, game device, and character control method according to the present invention, the placement section (in the placement step) may set primitives to the first bone and the third bone.
[0013] (6) In the program, information storage medium, game device, and character control method according to the present invention, the length L1 may be greater than the length L2, and the length L3 may be greater than the length L2.
[0014] (7) In the program, information storage medium, game device, and character control method according to the present invention, when the tip of the first bone corresponds to the hip joint of the character and the tip of the third bone corresponds to the tip of the leg of the character, the control unit (in the control step) determines the angle θ based on a distance d between the hip joint and a surface where the tip of the leg is in contact. a and the angle θ b may be calculated.
[0015] (8) In addition, in the program, information storage medium, game device, and character control method of the present invention, the control unit (in the control step) may set a target point for the character's arm or leg, and control the movement of the character's arm or leg based on the positional relationship between the target point and the character's torso.
[0016] (9) The program, information storage medium, game device, and character control method according to the present invention In the control method, the control unit (in the control step) sets the distance between the tip of the first bone and the target point as the distance d, and when moving the tip of the third bone to the target point, sets the angle θ a and the angle θ b may be calculated. [Brief description of the drawings]
[0017] [Figure 1] FIG. 2 is a diagram showing an example of functional blocks of the game device according to the embodiment. [Diagram 2] FIG. 2 is a diagram showing an example of a skeleton of a character placed in a virtual space. [Diagram 3] A diagram showing the anatomy of a character's arms and legs. [Figure 4] FIG. 4 is a diagram for explaining the derivation of an equation for determining the angle between a first joint portion and a second joint portion. [Diagram 5] 4 is a flowchart showing the flow of processing of the game device of the present embodiment. DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS
[0018] The present embodiment will be described below. Note that the present embodiment described below does not unduly limit the contents of the present invention described in the claims. Furthermore, not all of the configurations described in the present embodiment are necessarily necessary configurations of the present invention.
[0019] 1. Configuration An example of a functional block of the game device of this embodiment is shown in Fig. 1. Note that the game device of this embodiment may have a configuration in which some of the components (parts) of Fig. 1 are omitted. The game device is an information processing device such as a mobile terminal (smartphone, mobile phone, mobile game machine, etc.), a personal computer (PC), a stationary game machine, a game server (e.g., a cloud server), etc.
[0020] The input unit 150 is a device for inputting (detecting) input information from a player, and outputs the player's input information (operation information) to the processing unit 100. The functions of the input unit 150 can be realized by an input device such as a touch panel, a touch pad, a mouse, directional keys or buttons, or a keyboard.
[0021] The storage unit 170 stores programs and various data for causing the computer to function as each unit of the processing unit 100, and also functions as a work area for the processing unit 100, the function of which can be realized by a hard disk, RAM, or the like.
[0022] The display unit 190 outputs the game image generated by the processing unit 100, and the function thereof can be realized by a display such as a touch panel, LCD, or HMD (head mounted display) that also functions as the input unit 150.
[0023] The sound output unit 192 outputs the sound generated by the processing unit 100, and the function thereof can be realized by a speaker, a headphone, or the like.
[0024] The communication unit 196 performs various controls for communicating with the server or with other game devices, and the functions thereof can be realized by hardware such as various processors or communication ASICs, programs, and the like.
[0025] Note that programs and various data for causing a computer to function as each unit of the processing unit 100, which are stored in an information storage medium or memory unit of the server, may be received via a network, and the received programs and data may be stored in the memory unit 170. Such cases in which a game device is caused to function by receiving programs and various data are also included within the scope of the present invention.
[0026] The processing unit 100 receives input information (operation information) from the input unit 150, a program, and a communication unit 19. The processing unit 100 performs processes such as game progression, image generation, and sound generation based on data received via the processing unit 100. The functions of the processing unit 100 can be realized by hardware such as various processors (CPU, DSP, etc.) and ASIC (gate array, etc.), or by programs. The processing unit 100 includes a placement unit 110, a control unit 112, an image generation unit 120, and a sound generation unit 130.
[0027] The placement unit 110 performs processing to place and set a character in a virtual space (virtual three-dimensional space, object space). For example, the placement unit 110 determines the position and rotation angle (rotation angles about each of the X, Y, and Z axes) of the character in world coordinates, and places the character at the determined position and rotation angle. The character has a first bone, a second bone, and a third bone having a predetermined length, a first joint portion connecting the first bone and the second bone, and a second joint portion connecting the second bone and the third bone. The placement unit 110 sets primitives (objects configured of polygons, free-form surfaces, re-divided surfaces, etc.) to at least the first bone and the third bone.
[0028] The control unit 112 controls the angle θ of the first joint unit. a and the angle θ of the second joint bThe control unit 112 controls the first bone, the second bone, and the third bone to move on approximately the same plane, and calculates the angle θ based on the distance d between the tip of the first bone and the tip of the third bone, the length L1 of the first bone, the length L2 of the second bone, and the length L3 of the third bone. a and angle θ b The control unit 112 sets a target point of the tip of the character's arm or leg (a point on the surface where the tip of the arm or leg, which is the tip of the third bone, comes into contact), and calculates an angle θ from the positional relationship (distance d) between the target point and the character's body (the shoulder joint or hip joint, which is the tip of the first bone). a and angle θ b and controls the movement of the character's arms and legs. When a predetermined game event occurs, the control unit 112 may add a correction value to any of the lengths L1, L2, and L3 (change the length of any of the first bone, the second bone, and the third bone).
[0029] The image generation unit 120 performs drawing processing based on the results of various processes performed by the processing unit 100, thereby generating a game image including a character, and outputs it to the display unit 190. The image generation unit 120 generates an image (a so-called three-dimensional image) seen from a virtual camera (a given viewpoint) in a virtual space.
[0030] The sound generation unit 130 performs sound processing based on the results of various processes performed by the processing unit 100 , generates game sounds such as background music, sound effects, or voices, and outputs them to the sound output unit 192 .
[0031] The game device may also be configured as a server system. The server system may be configured with one or more servers (authentication server, game processing server, communication server, billing server, database server, etc.). In this case, the server system performs processing of each part of the processing unit 100 based on operation input (data input to an input part of a terminal) transmitted from one or more terminals (e.g., a smartphone, a mobile phone, a portable game machine, etc.) connected via a network, generates image generation data for generating an image, and transmits the generated image generation data to each terminal. Here, the image generation data is data for displaying an image generated by the method of this embodiment on each terminal, and may be image data itself or various data (object data, game processing result data, etc.) used by each terminal to generate an image.
[0032] 2. Method of the Present Invention Next, the method of this embodiment will be described with reference to the drawings.
[0033] 2 is a diagram showing an example of a skeleton of a character arranged in a virtual space. The character CR has a plurality of bones BN (bones) and joints JT (joints) that connect the bones BN to each other. Here, in this embodiment, the arm AM (arm skeleton) of the character CR is The leg LG (leg skeleton) is composed of three bones BN and two joints JT.
[0034] That is, as shown in FIG. 3, the arm AM and leg LG of the character CR have a bone B1 (first bone), a bone B2 (second bone), a bone B3 (third bone), a joint J1 (first joint) connecting the bone B1 and the bone B2, and a joint J2 (second joint) connecting the bone B2 and the bone B3. The bones B1, B2, and B3 each have a predetermined length, but the length of the bone B1 is greater than the length of the bone B2, and the length of the bone B3 is greater than the length of the bone B2. The length of the bone B2 may be greater than the lengths of the bones B1 and B3. Primitive PRs representing legs and arms are set to the bones B1 and B3, respectively. The primitive PR set to the bone B1 is an object representing the upper arm or thigh, and the primitive PR set to the bone B3 is an object representing the forearm or lower leg. In addition to the bones B1 and B3, a primitive PR may also be set to the bone B2.
[0035] The arm AM and leg LG of the character CR are connected to the body of the character CR (bones BN other than bones B1, B2, and B3) at the joint J0 at the tip of bone B1. When bones B1, B2, and B3 form the arm AM, joint J0 corresponds to the shoulder joint of the character CR, joints J1 and J2 correspond to the elbow joint, and joint J3 at the tip of bone B3 corresponds to the tip of the arm AM. When bones B1, B2, and B3 form the leg LG, joint J0 corresponds to the hip joint of the character CR, joints J1 and J2 correspond to the knee joint, and joint J3 corresponds to the tip of the leg LG.
[0036] The joint J0 has three rotation axes, but the joints J1 and J2 have one fixed rotation axis. The one rotation axis of the joints J1 and J2 is an axis perpendicular to the extension direction of the bones B1, B2, and B3, and is parallel to the rotation axis of the joint J1 and the rotation axis of the joint J2. In other words, the bones B1, B2, and B3 are controlled to move on approximately the same plane. In addition, the rotation angle of the joint J1 (angle θ a ) and the rotation angle of the joint J2 (angle θ b ) should be equal.
[0037] In this embodiment, target points (target positions) are set for the tips of the arms AM and legs LG of the character CR, and when the tip of the bone B3 (joint J3) is moved to the target point, the angle θ (θ=θ) of the joints J1 and J2 is calculated based on the distance d between the tip of the bone B1 (joint J0) and the target point, the length L1 of the bone B1, the length L2 of the bone B2, and the length L3 of the bone B3. a =θ b The target point is set on a surface that the tip of the arm AM or leg LG of the character CR comes into contact with when the character CR grabs an object, the hand of the character CR touches a wall or the like, the leg of the character CR climbs up a step, etc.
[0038] Hereinafter, the derivation of the equation for calculating the angle θ of the joints J1 and J2 will be described with reference to Fig. 4. Fig. 4 is a diagram showing bones B1, B2, and B3 on an xy plane. Point P1 corresponds to joint J0 at the tip of bone B1, point P2 corresponds to joint J1, point P3 corresponds to joint J2, and point P4 corresponds to joint J3 at the tip of bone B3. The angle θ of the joints J1 and J2 is shown as the exterior angle of point P2 and the exterior angle of point P3. Distance d is the distance between point P1 and point P4 (the distance between the tip of bone B1 and the tip of bone B3).
[0039] 4, the x and y coordinates of point P1 are (-L1cosθ, L1sinθ), the x and y coordinates of point P2 are (0,0), the x and y coordinates of point P3 are (L2,0), and the x and y coordinates of point P4 are (L2+L3conθ, L3sinθ). The distance d=|P4-P1|, and P4-P1 is expressed by the following equation.
[0040]
number
[0041]
number
number
number
[0042]
number
[0043] In the above example, the angle θ of the joint J1 a and the angle θ of the joint J2 b The case where the angles θ a and angle θ b Alternatively, one of the angles θ1 and θ2 may be calculated by using the formula (1), and the calculated angle may be added with a given correction value (a value between -30° and +30°) to obtain the other angle. a and angle θ b Difference (|θ a -θ b |) should be less than 30°. Also, in the motion created by the animator, the angle θ a and angle θ b If different, when the target point is set, the angle θ a and angle θ b The angle set by the motion The angle may be gradually made to approach the angle calculated by the formula (1).
[0044] In addition, in this embodiment, when a predetermined game event occurs (for example, an event in which the arms or legs of the character CR are transformed, or an event in which the character CR performs a special attack, etc.), a given correction value may be added to any of the lengths L1, L2, and L3 of the bones B1, B2, and B3 to change the length of any of the bones B1, B2, and B3. In this case, after changing the lengths of the bones B1, B2, and B3, the angle θ a ,θ b Alternatively, before changing the lengths of the bones B1, B2, and B3, the angle θ a ,θ b may be calculated.
[0045] In the above example, the first bone is connected to the body of the character (the first to third bones form the skeleton of the arms and legs of a humanoid character), but the first bone may be connected to another part of the character (such as the head). For example, the first to third bones may form the antennae or tentacles of an insect character, or the ears and tail of an animal character. The first to third bones may also form a weapon or the like that can be detached from the character's main body, or a single character may be formed by only the first to third bones.
[0046] 3. Processing Next, an example of the processing of the game device of this embodiment will be described with reference to the flowchart of FIG.
[0047] First, the placement unit 110 places the character CR in a virtual three-dimensional space (step S10). Next, the control unit 112 starts playing the motion (movement, action) of the character CR based on the motion data (step S11).
[0048] Next, the control unit 112 judges whether or not to correct the position of the tip of the bone B3 (the tip of the arm AM or leg LG of the character CR) (step S12). When the tip of the arm AM or leg LG of the character CR needs to be corrected (Y in step S12), such as when the tip of the arm AM or leg LG contacts a wall, floor, or other object, the control unit 112 sets the target point of the tip of the bone B3 to the surface that the tip of the arm AM or leg LG contacts (step S13). Next, the control unit 112 calculates and sets the angle θ of the joints J1 and J2 by equation (1) based on the distance d between the tip of the bone B1 (joint J0) and the target point, the length L1 of the bone B1, the length L2 of the bone B2, and the length L3 of the bone B3 (step S14). Next, the control unit 112 rotates the joint J0 so that the line segment connecting the tip of bone B1 and the target point coincides with the line segment connecting the tip of bone B1 and the tip of bone B3, thereby moving the tip of bone B3 to the target point (step S15).
[0049] The present invention is not limited to the above-described embodiment, and various modifications are possible. For example, a term cited as a broadly defined or synonymous term in the description in the specification or drawings can be replaced with a broadly defined or synonymous term in other descriptions in the specification or drawings. [Explanation of symbols]
[0050] 100: processing unit, 110: placement unit, 112: control unit, 120: image generation unit, 130: sound generation unit, 150: input unit, 170: storage unit, 190: display unit, 192: sound output unit, 196: communication unit
Claims
1. A program for causing a character placed in a virtual space to execute a given action, the character has a first bone, a second bone, and a third bone, each having a predetermined length, a first joint portion connecting the first bone and the second bone, and a second joint portion connecting the second bone and the third bone; an arrangement unit that arranges the character in a virtual space; The angle θ of the first joint a and the angle θ of the second joint b and causing a computer to function as a control unit that controls the movement of the joints associated with the character's movement; The control unit is The first bone, the second bone, and the third bone are controlled to move on approximately the same plane, and a distance d between the tip of the first bone and the tip of the third bone and a length L of the first bone are controlled. 1 and the length L of the second bone 2 and the length L of the third bone. 3 Based on this, the angle θ a and the angle θ b A program for calculating
2. In claim 1, The angle θ a and the angle θ b are equal.
3. In claim 1, The control unit is The angle θ a and the angle θ b A program for calculating [0010]
4. In any one of claims 1 to 3, The control unit is When a predetermined game event occurs, the length L 1 , L 2 , L 3 A program for adding a correction value to any one of the above.
5. In any one of claims 1 to 3, The placement unit is A program for setting primitives to the first bone and the third bone.
6. In any one of claims 1 to 3, The length L 1 is the length L 2 is greater than the length L 3 is the length L 2 A program characterized in that:
7. In any one of claims 1 to 3, When a tip of the first bone corresponds to a hip joint of the character and a tip of the third bone corresponds to a tip of a leg of the character, The control unit is Based on the distance d between the hip joint and the surface where the tip of the leg contacts, the angle θ a and the angle θ b A program for calculating
8. In any one of claims 1 to 3, The control unit is A program for setting a target point for an arm or leg of the character, and controlling the movement of the arm or leg of the character based on the positional relationship between the target point and the body of the character.
9. In any one of claims 1 to 3, The control unit is When the distance between the tip of the first bone and the target point is the distance d and the tip of the third bone is moved to the target point, the angle θ a and the angle θ b A program for calculating
10. A game device that causes a character placed in a virtual space to perform a given action, the character has a first bone, a second bone, and a third bone, each having a predetermined length, a first joint portion connecting the first bone and the second bone, and a second joint portion connecting the second bone and the third bone; an arrangement unit that arranges the character in a virtual space; The angle θ of the first joint a and the angle θ of the second joint b and a control unit that calculates the joint movement according to the character's movement and controls the joint movement according to the character's movement. The control unit is The first bone, the second bone, and the third bone are controlled to move on approximately the same plane, and a distance d between the tip of the first bone and the tip of the third bone and a length L of the first bone are controlled. 1 and the length L of the second bone 2 and the length L of the third bone. 3 Based on this, the angle θ a and the angle θ b A game device comprising:
11. A character control method for causing a character placed in a virtual space to perform a given action, comprising the steps of: the character has a first bone, a second bone, and a third bone, each having a predetermined length, a first joint portion connecting the first bone and the second bone, and a second joint portion connecting the second bone and the third bone; a placement step of placing the character in a virtual space; The angle θ of the first joint a and the angle θ of the second joint b and a control step of calculating the joint position and controlling the joint movement associated with the character's motion, In the control step, The first bone, the second bone, and the third bone are controlled to move on approximately the same plane, and a distance d between the tip of the first bone and the tip of the third bone and a length L of the first bone are controlled. 1 and the length L of the second bone 2 and the length L of the third bone 3 Based on this, the angle θ a and the angle θ b A character control method comprising the steps of:
Citation Information
Patent Citations
Motion generating system using multiple structure
JP2004062692A
Methods for modeling the movement of connected objects
JP2010532895A
Attitude control method for skeleton model, and program
JP2013120395A
Image reproduction program and game system
JP2013200770A
Processing system, information processing device, program and processing method
JP2021043611A
