Maya->Unity problem. Rig, Skins, RigidSkins and so on...

Yo there.
I have a character rigged, and it has pieces of armor.

First of all, the “requirement”: I need to move some parts of the rig inside unity
Single joint hierarchy, normal skinning for the bodyparts + rigidskins for all the armor pieces.

I tried constraints before rigid skinning the armor parts, but they wouldn’t work except when baked, and so i won’t have control over the animation procedurally.

Now on the problem: when importing the model (WITHOUT baking, i still don’t have animations), i DO NOT HAVE in unity the rigid skinned parts.

The model in the back (the one with the gun) is with constraints + baked animations. It works ok but i cannot move the bones procedurally overriding the animation.

The model in the front is the one without constraints, all skinning. As you can see all the armor parts vanished (the leg parts are parented as is the head).
But i can move it with a script.

I’m at a blind point now.
In the FBX export on maya i checked “Animation” and “Deforming Geometry” (with Skinning checked)

Tried various fbx versions but no luck.

Any clue?
Thanks

Hi akabane,

It’s a bit hard to follow :slight_smile: Could we split it into separate problems?

  1. “I can not modify positions when playing animation”. How are you modifying positions? You should be able to override/postprocess animation in lateUpdate
  2. It sounds like you’re saying “I don’t need animations, I just want my model with skin”. I looks like you’re able to import mesh with animations. What if you disable “play automaticaly” on animation or disable animation import from Unity side?

Sorry, if this is not what you were asking… Example project with several models and scenes demonstrating the issues would help…

Hi, thanks for reply Paulius :smile:
I’m sorry for not being so much clear.

Trying to explain myself better.

I have this rigged character, and I need to move the torso bone within unity (mouse control).

Let’s take out the maya-made animations from the discussion for now.

So I only have this thing, rigged with soft bind for the body parts, and rigid bind for the armor parts.

Just when trying to import that into Unity (manual FBX export, since the auto fbx doesn’t work anymore, i guess since i installed Maya 2011, that may have screwed up the export because of fbx2011 - working with 2010 anyway, and using fbx2010 or 2009 to export) the body parts show up, but not the rigid binded parts (any of them).
And i don’t know why.
I think i tried almost every single export options but no luck.
In the img posted before, the armored guy with the gun had the armor pieces NOT rigid binded, but constrained.
AND, that led to the fact that i had to forcefully bake everything to make those follow the animation (hence cutting away the possibility of animation overriding)




As for what the animation overriding is concerned, i tried a really simple script, that’s really something like this:

var myJoint : Transform;
var pos;

function Update()
{
pos = Input.GetAxis("Mouse X");
}

function LateUpdate()
{
myJoint.rotation.y = pos;
}

also used myJoint.rotation.y += pos to have a slightly less jittered motion, but anyway that doesn’t work IF THE MODEL IS ACTUALLY ANIMATED (and the animation started obviously). :smile:

IF the model HAS animations but it’s NOT playing animations, that works flawlessly. :slight_smile:

But if it’s playing some sort of animations, every time i use that script for example, every tot frames the position returns to the original animation driven one, and so i have a really unusable jittery motion :slight_smile:


//ENDING THOUGHTS//

Since i had those problems, i thought “Hey, why just not animate for example the legs in maya, or everything directly in unity, so that my torso bone does not have keyframes and i’ll be able to move it accordingly to mouse movement?”

And so i rigidbinded the armor pieces (to make all the upper body parts follow the torso bone), and, for the soft skinned parts, it works of course.

The problem is, the rigid binded things do not get into unity (even if I see them in the unity hierarchy).

Hope i’ve been a little clearer now. :slight_smile:
If you need and want i can provide you with the actual .mb or .ma model i’m talking about via PM.
In the unity part there’s really little to share, it’s a simple fbx imported into it and applied the forementioned script. :slight_smile:

Thanks
Akabane

As far as I know, Rigid Binds are not supported in Unity, or any other game engine I have used… Switch the armor to Smooth Binds and set all the values to 1 in the component editor.

Yes, Unity 2.6.1 is not compatible with Maya 2011 (to be more specific - fbx formats are not compatible). It is fixed in Unity 3.0 - it will use Fbx2011 as a default.

It might be that melmonkey is right - rigid binding is not supported. I can’t really remember. Could you send me your file (Maya2010 format, or any fbx which can be imported back to Maya2010)? I’ll check it out. Even if Unity doesn’t support rigid bind - it should give some kind of warning about that. I want to fix it.

I double checked it (in C# and JavaScript). Changing transforms in LateUpdate works for me with and without animations playing. Could you make a minimal project which has this problem and send it to me?

As melmonkey said you could use smoothskining and just skin skin whole part to single bone. It would be the same thing from game point of view (but as I said I want to fix the actual problem and give a warning at least).

Hi! Thanks both for the replies.
Melmonkey, i didn’t know rigid binding wasn’t supported. I thought that unity considered them like smooth bindings with fullskinning per-bone.
Thanks for the advice :slight_smile:

Paulius: thanks for the reply. I’m sending you via PM a link to download a test scene + the maya model (2010 .mb format).

Thanks both!

EDIT: PM sent :smile:

Change your script to the following:

var jointSX : Transform;
var jointDX : Transform;

var mouseX = 0.0;

function Update () {
	mouseX += Input.GetAxis("Mouse X");
}

function LateUpdate()
{
	jointSX.rotation.y += mouseX;
	jointSX.rotation.x += mouseX;
	jointDX.rotation.y += mouseX;
	jointDX.rotation.x += mouseX;	
}

The main change is: mouseX += Input.GetAxis(“Mouse X”);

Input.GetAxis(“Mouse X”) returns delta since last frame - that’s why you get jittery movement. What you want is to accumulate “total mouse movement”.

BTW: I’m not sure if "jointSX.rotation.y += " is a good idea. rotation is stored as quaternion IIRC (i.e. not euler angles), so modifying it by member it’s not something I would do. Do something like this:
jointDX.rotation *= Quaternion.EulerAngles(mouseX, 0, 0);

makes more sense to me.

I’ll look into rigid skinning issue now.

I checked the skinning problem. I can reproduce your problem in Unity 2.6.1, but it works fine in Unity 3.0alpha4, so the problem has been fixed either from our of FBX side.

So I guess the temporary workaround is to use smoothbind - as I said it’s the same thing performance/memory wise from game point of view.

Thank you really a lot for the script correction.
Didn’t think of that Update() change, you really are great :smile:

Thanks a lot!
Looking forward also to see how the rigidbinding will be fixed/advised with an error :wink:

Akabane