Is it possible to change InteractionObjects at runtime? I have a working interaction system, on my AI. I’m trying to extend it so it can interact with different interaction object scripts while moving around. Possibly triggered from a collision, or a tag. I thought the touch walls demo would provide an answer but that interaction is limited, as it should be. Any suggestions how to do this?
Yes, you could for instance create a sphere with a isTrigger collider and an isKinematic rigid body. That will become the trigger for all interaction objects that enter it’s sphere. Parent it to the character. Now you need to add a little script like that:
public InteractionSystem interactionSystem;
public FullBodyBipedEffector effectorType;
private InteractionObject interactionObject;
void OnTriggerEnter(Collider c) {
if (interactionSystem.IsInInteraction(effectorType)) return;
interactionObject = c.GetComponent<InteractionObject>();
if (interactionObject == null) return;
interactionSystem.StartInteraction(effectorType, interactionObject, false);
}
So basically whenever an interaction object (with a collider) enters the trigger of the sphere, it calls an interaction with that object.
You can have multiple trigger spheres like that for each effector and position them relative to the character so that they represent the area that is comfortably reachable by those effectors.
Hope it helps,
Hi, Chariots, yes it works with Generic, Humanoid and Legacy, doesn’t matter to Final IK really.
The only reference to the Animator/Animation component that Final IK has, is just to find out if animatePhysics is on or off for the character.
Half of my demo scenes are made with the Generic rig so no limitations that I can think of
No I didn’t go into that much depth with that. I just defined hit points like head, chest, hips and so on and specified the effectors that they use. Then I wrote a script that lets you add force to those effectors similar to rigidbody.AddForce, so you could call headHitPoint.AddForce(Vector3 v); So the actual hit detection should be done by another script.
EDIT: Nevermind. I fixed it. He get this awkward position because of the “T-Pose” before the game starts.
I just opened the Animation tab (normal animation, not the Animator), selected the Idle animation, played the animation and set the anim to Frame 1 (to change the start position of the character).
After that when you start the game, the character (model) is in the right start position and will not bug anymore.
Hi. I’m having some issues with the FBBIK component. For example, I’m using a biped-rigged model from Autodesk Character Creator, configured to work with Mecanim. Everything in the animation part is working. But I have tried to use the “Body Tilt” Scripts from the Demos (I copied the original Legacy Animation plugin from Character Controller to work with Mecanim) with the FBBIK component and setup into my character. The script is working, but I’m getting some issues with the Model Knees, they are both crooked and the effect looks horrible I tried to rotate the bones manually like the video (https://www.youtube.com/watch?v=EJig15GxaBA) but remains the same effect. Here is some screens showing the effects with/without the FBBIK component activated. Scripts config:
Congratulations on the latest release of your excellent package. I’ve been struggling with a number of issues, which I had not been able to solve before. However, with your latest release, I think these issues are a lot more efficient to solve. Seeing how you are the expert on your system, I think you can advise me best how to overcome them. I would greatly appreciate if you could point me in the general direction of how to fix these. Please find them below:
Upper body rotation
Using aimIK, I’ve configured the upper body to rotate independently from the lower body. Now this works fine until you start looking behind the character (see image). It uses roughly the same setup as your aim swing example scene. I’d like to add in a few constraints, so it will use more horizontal rotation to achieve the goal. I’ve tried adding in rotation constraints, but to no avail. Maybe I’m using them wrongly?
Upper body Rotation Offset
The second issue I’m experiencing, which Unity’s animation cannot cope with (believe me, I’ve tried all possible options), is to keep original animation orientations relative to the original root facing when blending animation layers. I’ve separated the upper and lower body layers, and the upper body will always inherit the lower body’s root rotation. Layer 0 is the root, first spine bone and everything down. Layer 1 is the second spine bone and everything up.
Since the lower body will be playing different animations depending on the movement state, which come with different rotations, the upper body rotation will always be offset by the rotation of the first spine bone in the first animation layer. I’ve tried all possible combinations regarding baking rotation into poses and basing them on the original or not. I’ve also tried layer masking the lower body animations’ upper body bones, but to no avail. Unless I’m something wrong, the only option I see would be to override that rotation offset using IK.
Now, it would be perfectly fine to rotate the upper body based on the camera facing, and with the latest effector offsets I’m thinking there are more options now. Ideally it would be integrated with the Aim IK component, but if there are better ways to go about it I’d love to hear them.
Hello, Pertal.
Thanks for your help the other day.
Excuse me, I have only a minimum question.
I’m trying now, change AimIK Component’s bones setting (under Use Rotation Limits) on script.
There are change bones function for AimIK?
About the upper body rotation… The reason why the spine bends back like this when looking behind, is that at exactly 180 degrees from the animated direction there is a singularity point at which there is no way for AimIK to tell which way to twist the spine to reach to the target. Thats why it has the Clamp Weight property (just like Unity’s own SetLookPosition has for the same reason). It is a logical inevitability, behind the character is a flipping point where there are infinite amount of solutions (if you stand on the North Pole, which way is closest to the South Pole? ;)).
If you just want to avoid bending back the spine, you could use the Rotation Limits with AimIK. The best way would be to have Hinge limits on the spine (without “Use Limits” checked) that would limit the rotation of the spine bones used by AimIK to twist only. Now just doing that would keep the spine stiff and interfere with the animation so to avoid that you should default the rotation limit at each LateUpdate to it’s current rotation. You can do it like this:
public AimIK aim;
void LateUpdate() {
// Set current animated localRotation as default local rotation for the rotation limits so they wouldn't interfere with the animation
for (int i = 0; i < aim.solver.bones.Length; i++) {
if (aim.solver.bones[i].rotationLimit != null) {
aim.solver.bones[i].rotationLimit.SetDefaultLocalRotation();
}
}
}
That way the rotation limits only have an effect on the Aim IK and not the animation.
The spine will still flip at 180 degrees, if you want to avoid that, you would need a look left/right additive animation before AimIK to help it “know” which way to twist the spine.
Now to your second question about the upper body rotation offset, that is a classic masking problem. It is especially difficult when using the Humanoid rig, because the humanoid mask is so restricted. Unfortunately Unity’s animating systems not Legacy nor Mecanim can be accessed in between layers. If we could read the bone rotations between layer 0 and before layer 1 then it would be quite easy to use IK to manipulate with the result, but without that I can’t think of an elegant solution.
If the case is just that you need the pelvis to move with the legs and the spine be independent from that motion, you could just keep the first spine bone fixed in LateUpdate like this:
Using tweening curves with dampening and spring, he shows you can make some very convincing animation with a very limited amount of keyframes. The walk cycle is 2 keyframes, crouching as well, jumping too. It’s all very impressive. My question is not directly whether or not this is possible with FINAL IK, but maybe it can inspire you with some new ideas for the future of FINAL IK?
Hey, thanks a lot OnePxl,
I already noticed that video yesterday on Twitter. Actually I’ve been following the development of Overgrowth for years now and it has been a true inspiration all along. Not much there in terms of IK, I mean he uses very simple IK like the one that Unity has built in, but what he does procedurally is amazing. I also like the active ragdoll stuff that goes on in there and I have a very similar solution in development in that matter.
Hello Pärtel, I’m curious to see what you come up with!
In your opinion, is it possible to mimic the procedural animation system of Overgrowth in Unity? (I sense from your answer that FINAL IK would not be the way to replicate the effects, am I right?)
Hi, could you be a bit more specific please? do you mean like doing some interactions with the hands or what? Because normally all weapon animations and such are just animations, no IK.
No, not in Final IK, because it’s not really IK, but another package that would work nicely together with Final IK. Something looking a bit like this
Hey, thanks for the purchase and the kind words, much appreciated!
Yes I think its possible, I mean if you just want to blend between 2 or more keyframes, you have the Mecanim blend trees for that, that can be very powerful. The difficult part is the physics and especially blending between animation and physics, because in Unity we have very little control over the execution of animation and physics.
On a related note, 0.4 is in the works, this one will not be about new features, but consolidating old ones, fixing bugs and improving the performance.
(FBBIK will have about 20% performance boost :)). No ETA yet though, will take some time and I got Nordic Game to attend soon