Bought it, looked at the provided examples and Iâm very pleased with my purchase. Time to fidle with it and see how it can affect the overhaul look and feel of our game.
The money to get this delight of movey stuff is apparently assured although could be anytime in the next month, but it is as inevitable as horde of adoring girls you will have swarming around you for such a mighty thing (100% going to happen)
You should not use IK nor physics for this particular case. While it is no problem for Trigonometric, Limb, CCD or FABRIK solvers to solve the position of the piston, this particular problem presents us with 2 singularity points: one when the rod is completely stretched out and the other exactly 180 degrees from that. At those points there is mathematically no way to tell which way to rotate, so you will have a continuity problem where you canât control the spinning direction of the wheel. The same problem exists in mechanics, imagine, if the rod was fully stretched out or completely collapsed and you would suddenly apply huge pressure on the piston in the direction of the rod, you would simply blow up the engine. You can try using physics, but I bet it will be just jittery and unstable.
If you can instead control the rig by spinning the wheel instead of moving the piston, the problem can be solved with simple trigonometry. Try this code:
using UnityEngine;
using System.Collections;
public class Piston : MonoBehaviour {
public Transform root, bone1, bone2, bone3;
void Update () {
Vector3 B = Vector3.Project(bone2.position - bone1.position, root.up);
float b = B.magnitude;
if (Vector3.Dot(B, root.up) < 0f) b = -b;
float c = Vector3.Distance(bone2.position, bone3.position);
float a = Mathf.Acos(b/c) * Mathf.Rad2Deg;
Quaternion rotation = Quaternion.AngleAxis(-a, root.right);
bone2.transform.rotation = Quaternion.LookRotation(rotation * -root.up, bone2.transform.up);
bone3.transform.rotation = Quaternion.LookRotation(root.forward, root.up);
}
}
bone 1 should be the wheel, bone2 the middle joint, bone3 the last joint connected to the piston. Root is the parent of bone1, bone2 is the child of bone1 and bone3 is the child of bone2. All bones should be facing in the same direction (local forward axis towards the next bone).
rotate bone1 around to see how it worksâŚ
If you have more questions about this, just PM me, letâs keep this thread about Final IK
Ahh yes like Steve said, i was extremely surprised at the price, very generous, a few things popping now asset wise that seem very sensible decisions and this is one
Wow. I currently have no practical use for this, but I am going to get it anyway just to make big procedural multi-leg robots. Iâll figure out what to do with them later.
Pärtel, I am answering to your reply on my little connection rod and piston setup.
You are completely right in every point and I forgot to say that it´s indeed the wheel that I am turning and the piston movement is the result
of the chain. So, your plugin would also be able to do this, right?
And thanks very much for your script. It´s tiny, it´s working, it´s magic to me as a beginner (never knew about Quaternion.LookRotationâŚ)
You could get the piston rig running with Final IK so that you control it from the piston (because thats what IK does, it solves for the position), but that would present you with all the problems that I described earlier. But anyway, Iâm glad I could help
To the rest of you, thank You again, and check out the new tutorial. This one is about UMA integration and adding FBBIK in runtime: https://www.youtube.com/watch?v=3droBqtPZkw
Cheers Partel Thatâs got a few bits of juicy code in there too
One problem with attaching the FBBIK component at runtime when the UMA is generated, is that the Animator is very slow to start up. If your script builds an UMA and attaches FBBIK - you get 999+ warnings that the Animator isnât initialised - and therefore FBBIK doesnât grab all the references. Unfortunately, there seems to be no method of telling if the Animator is initialised or not (you can tell if itâs null or not - but that doesnât help us here).
This is one thing that Iâd really like to find a solution for, as even a blunt yield wait isnât always perfect. Itâs not a fault with FBBIK, but with the Animator. Iâve not found a way to fix this yet.
Google is full to overflowing with this error - lots of people having it in all sorts of situations.
I am very interested in this, but the performance worries me slightly. With 100 characters, you end up running at ~50 fps? The problem with this, for me - is that I will have a lot of characters on screen but I am scared that the IK system will eat all my available CPU, giving me no CPU left over for the actual game logic.
Would it be possible to see a video or screenshot of how the Unity Profiler when running 100 characters?
Hmm⌠Iâm adding FBBIK in code with AddComponent - but Iâm getting endless errors:
The warning âFBIK Chain contains no nodesâ, followed by endless
IndexOutOfRangeException in RootMotion.FinalIK.IKSolverFullBodyBiped.GetEffector on line 170
In the video you show how to add the FBBIK component by code - but it neatly skirts the the problem, by having to drop the umaCharacter onto the component in the Inspector. Trying to add FBBIK component post avatar generation is proving much harder
I should add that when adding FBBIK component by code - FBBIK automatically gets itâs references list just fine