Ik setup




















This will be used for the IK solver. As with all things, a little bit of planning goes a long way. Make sure you have an idea if what you need your IK setup to do.

Is it for a character's feet? Their hands? What will they be doing where they will need to react? The more of these questions you can answer early, the easier the setup will be.

Fortunately, with the power of UE4's Blueprint visual scripting, it will be easy enough to add functionality later. For the first example, we will give an overview of setting up simple IK on a character to help their feet remain planted on uneven ground. This example can be found in the Content Examples project. Just open the map named Animation. The first step will be to set up the Pawn or Character Blueprint to properly handle the necessary data.

This essentially means that we need to perform some traces from the feet so that we can keep track of when there is some sort of obstacle in place that they should step on. Be aware that in the following examples, a few variables were added just to simplify wire connections within the Blueprint, to make them a little less visually confusing for documentation.

These variables will not exist in the actual Content Example project. The Construction Script of the Character Blueprint really just sets up two critical pieces of data:. An IKTraceDistance variable, which uses the half-height of the physics capsule multiplied by the Scale. For this setup, the Event Graph is essentially responsible for handling the trace operation, which simply casts down through the foot of the character, looking for some sort of obstacle.

If it finds something, it stores the distance so that it can be used later in the Animation Blueprint to move the effector for the IK. One of the important points about this graph is the use of a custom function called IKFoottrace.

This function takes in a distance and Socket name, using those as the basis for the trace operation. It then returns an offset value based on those results that will be later used to offset the location of the IK effector. In this image, you can see the IKFoottrace function. Click the image for a larger view or Right-click and Save As. And here is the event graph.

With the help of the above function, you can see that its main job in this instance is just to perform traces for the right and left feet. Here is the base level of the Event Graph.

The result of this is that during each tick of the game, there is a downward trace taking place, looking for an impact point which would designate some uneven piece of ground to be accounted for.

When found, the distance to that point is stored as an IK offset to be used later on in the Animation Blueprint. In the image above, the green diamond represents the location of the Socket used as the trace starting point. The red arrow represents the trace itself. The first time you start the editor from a fresh source build, you may experience long load times. The engine is optimizing content for your platform to the derived data cache , and it should only happen once.

Your private forks of the Unreal Engine code are associated with your GitHub account permissions. If you unsubscribe or switch GitHub user names, you'll need to re-fork and upload your changes from a local copy. The first part of the Animation Blueprint we will look at is the Event Graph. Generally speaking, the main purpose of the Event Graph in an Animation Blueprint is to take in data from other sources - such as the Character or Pawn Blueprint - and then translating those into variable updates that can be used in the AnimGraph.

In this case, the first thing we do is get the current Pawn and then make sure to cast that to the specific Pawn-based class in which we did all of our setup. This allows us to communicate directly that specific instance of the Pawn Blueprint and read the data stored in its variables. With the IK offset data that was stored in the Pawn Blueprint, we can generate location vectors to later be used by the IK effectors.

The AnimGraph culminates our setup by applying the information assembled thus far and using it to update the existing animation created for the character. For this example, the AnimGraph is very simple in that it is really only playing a single animation.

To do this, you can select some elements on your character and exclude them from the skeleton. Once you remove the extra elements from the skeleton, set the bone orientation for the extremity parts. By default, they are oriented horizontally towards the right.

This orientation often works for the feet but not necessarily for the hair or hands. Harmony allows you to set a minimum and maximum angle constraint on certain joints, such as the knees or elbows. When using the Inverse Kinematics tool or even the Forward Kinematics Transform tool , it is possible that some joints will bend in the wrong direction.

If you plan to animate a lot with the Inverse Kinematics tool, it's a good idea to try the angle constraints. The angle constraints can be set by the character builder or by the animator in particular scenes where it's needed.

It is recommended to use the minimum and maximum angles only if the character does not change view within the same layers. For example, if a character is facing the camera and has some angle limitations enabled, it could be problematic if the character switches to side or quarter view since the joints won't bend the same way.

Use the minimum and maximum angle constraints if your character's views are in different templates or layers. If the character's views are in the same layers, then it's better not to use the angle constraints. The content reflects the features found in the latest Harmony 14 release.



0コメント

  • 1000 / 1000