|
@@ -2127,6 +2127,88 @@ CrowdAgents' handle navigation areas differently. The CrowdManager can contains
|
|
|
|
|
|
|
|
See the 39_CrowdNavigation sample application for an example on how to use CrowdAgents and the CrowdManager.
|
|
See the 39_CrowdNavigation sample application for an example on how to use CrowdAgents and the CrowdManager.
|
|
|
|
|
|
|
|
|
|
+
|
|
|
|
|
+\page IK Inverse Kinematics
|
|
|
|
|
+
|
|
|
|
|
+\section Overview
|
|
|
|
|
+
|
|
|
|
|
+IK (Inverse kinematics can be useful in many situations ranging from
|
|
|
|
|
+procedural animation to small adjustments of animation. Simply put, IK is used
|
|
|
|
|
+when you want to position the tips of a hierarchichal structure at a known
|
|
|
|
|
+location and need to calculate all of the rotations of the parent joints to
|
|
|
|
|
+achieve this.
|
|
|
|
|
+
|
|
|
|
|
+Examples include: Moving a hand to pick up an object, or adjusting a foot so
|
|
|
|
|
+it's always touching the ground, regardless of incline, or even precisely
|
|
|
|
|
+ligning up a large tentacle in order to penetrate... Never mind.
|
|
|
|
|
+
|
|
|
|
|
+\image html ik_foot_demo.gif
|
|
|
|
|
+
|
|
|
|
|
+\section Terminology
|
|
|
|
|
+
|
|
|
|
|
+It is good to know some of the terminology used when talking about inverse
|
|
|
|
|
+kinematics, so you can better understand what's being said.
|
|
|
|
|
+
|
|
|
|
|
+\image html ik_terminology.png
|
|
|
|
|
+
|
|
|
|
|
+ - The upper-most node in a solver's tree is known as the \a base \a node or \a root \a node.
|
|
|
|
|
+ - Nodes which need to be moved to a specific target location (example: The hand of a human) are called an \a end \a effector.
|
|
|
|
|
+ - Joints at which multiple children branch off from are called a \a sub-base \a node.
|
|
|
|
|
+ - IK solvers work most efficiently on single "strings" of nodes, which are referred to as \a chains.
|
|
|
|
|
+ - The entire structure (in the case of a human with two hands) is called a \a chain \a tree.
|
|
|
|
|
+
|
|
|
|
|
+\section End Effectors
|
|
|
|
|
+
|
|
|
|
|
+Effectors are used to set the target position and rotation of a node. You can
|
|
|
|
|
+create one by attaching the IKEffector component to a node.
|
|
|
|
|
+
|
|
|
|
|
+\code{.cpp}
|
|
|
|
|
+Node* node = model->GetChild("Hand.R", true);
|
|
|
|
|
+IKEffector* effector = node->CreateComponent<IKEffector>();
|
|
|
|
|
+\endcode
|
|
|
|
|
+
|
|
|
|
|
+The effector has a few parameters that allow you to control how it targets
|
|
|
|
|
+another object. You can set its target position either directly with
|
|
|
|
|
+IKEffector::SetTargetPosition or you can tell it to copy the position and
|
|
|
|
|
+rotation of another node in the scene with IKEffector::SetTargetNode (or, if
|
|
|
|
|
+you only know the name of the node, IKEffector::SetTargetName. If there are
|
|
|
|
|
+multiple nodes in the scene with the same name then the first one found will
|
|
|
|
|
+be used).
|
|
|
|
|
+
|
|
|
|
|
+The target position and rotation are both set in global space.
|
|
|
|
|
+
|
|
|
|
|
+Another important parameter is the \a chain \a length,
|
|
|
|
|
+IKEffector::SetChainLength. A chain length of 1 means a single segment or
|
|
|
|
|
+"bone" is affected. Arms and legs typically use a value of 2 (because you only
|
|
|
|
|
+want to solve for the arm and not the entire body). The default value is 0,
|
|
|
|
|
+which means all nodes right down to the base node are affected.
|
|
|
|
|
+
|
|
|
|
|
+Effectors have a \a weight parameter (use IKEffector::SetWeight) indicating
|
|
|
|
|
+how much influence it has on the tree to be solved. You can make use of this
|
|
|
|
|
+to smoothly transition in and out of IK solutions. This will be required for
|
|
|
|
|
+when your character begins picking up an object and you want to smoothly
|
|
|
|
|
+switch from animation to IK.
|
|
|
|
|
+
|
|
|
|
|
+\code{.cpp}
|
|
|
|
|
+effector->SetWeight(SomeSplineFunction());
|
|
|
|
|
+\endcode
|
|
|
|
|
+
|
|
|
|
|
+\image ik_effector_weight.gif
|
|
|
|
|
+
|
|
|
|
|
+If you've played around with the weight parameter, you may have noticed that
|
|
|
|
|
+it causes a \a linear interpolation of the target position. This can look bad
|
|
|
|
|
+on organic creatures, especially when the solved tree is far apart from the
|
|
|
|
|
+original tree. You might consider enabling \a nlerp, which causes the weight
|
|
|
|
|
+to rotate around the next sub-base joint. This feature can be enabled with
|
|
|
|
|
+IKEffector::EnableWeightedNlerp.
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+If required, you can also set the target rotation with
|
|
|
|
|
+IKEffector::SetTargetRotation. Note that this is disabled by default (more on
|
|
|
|
|
+this later in the solver section).
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
\page UI User interface
|
|
\page UI User interface
|
|
|
|
|
|
|
|
Urho3D implements a simple, hierarchical user interface system based on rectangular elements. The elements provided are:
|
|
Urho3D implements a simple, hierarchical user interface system based on rectangular elements. The elements provided are:
|