@weitjong please do not lock this even if you find similar topic
@TheComet this topic is mainly addressed to you, but I think it should be interesting to others.
As work on bug #1957 looks like done by @TheComet and IK should be usable on mass instances.
I tried to test it today, but I could not make it work in my case of 100 NPCs.
I’m probably stupid, but I see no effect, but lets clarify proper setup procedure. I know IK is not ready to run Makehuman characters, but anyway I want to see some effect over there.
So what I do: I create IKEffector on foot.L and foot.R
I set chain length to 4 for each.
I add IKSolver
I disable auto-solving
I subscribe to events
I call Solve() from event
void Init()
...
Node@ leftFoot = node.GetChild("foot.L", true);
Node@ rightFoot = node.GetChild("foot.R", true);
IKEffector@ leftEffector = leftFoot.CreateComponent("IKEffector");
leftEffector.chainLength = 4;
IKEffector@ rightEffector = rightFoot.CreateComponent("IKEffector");
rightEffector.chainLength = 4;
Node@ spine = node.GetChild("spine02", true);
IKSolver@ solver = spine.CreateComponent("IKSolver");
solver.algorithm = IKAlgorithm::FABRIK;
solver.SetFeature(IKFeature::AUTO_SOLVE, false);
SubscribeToEvent("SceneDrawableUpdateFinished", "HandleSceneDrawableUpdateFinished");
...
}
void HandleSceneDrawableUpdateFinished(StringHash eventType, VariantMap& eventData)
{
Node@ rfoot = node.GetChild("foot.R", true);
Node@ spine = node.GetChild("spine02", true);
IKSolver@ solver = spine.GetComponent("IKSolver");
IKEffector@ re = rfoot.GetComponent("IKEffector");
re.targetPosition = Vector3(0, -1, 0);
solver.SetFeature(IKFeature::UPDATE_ORIGINAL_POSE, true);
solver.Solve();
}
Do I miss anything?