Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
13 Jun 22 - 14 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
1
Question by alexanderflink · Apr 08, 2013 at 07:48 AM · blenderbonesforwardarmaturez axis

How to make blender bones z axis forward in Unity

Hi. I do realize this might be more of a Blender than a Unity question, but I figured that this might be the right place to ask since people on the blender forum might not know the relation between Blender-Unity coordinate system.

My problem is that I want to easily be able to rotate bones on my character by using the LookAt function. Currently this is horrible since I have no idea how the axes on each bone are configured. There are currently two bones I want to rotate using LookAt.

alt text alt text

In Blender, the bones both bones are pointing out of the arms, and what I want is for the z axis to always point forward, out of the arms in this case, the y axis to point up and the x axis to point right. I suppose that this is something that perhaps has to be done in Blender? Heres how it looks there.

alt text

I know that there are some configurations that can be made when you export as an .fbx in Blender, these have not helped with the bones though. The axes of the whole model are fine. Z points forward, Y up, and x horizontal. Here are my Blender export settings.

alt text

EDIT: I just realised that the picture above is an old one. The forward of my current export is actually set to Z axis, and not -Z axis. This makes the model's forward face the z direction in unity, but it does not help with the bones.

Comment
Add comment · Show 5
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image alexanderflink · Apr 08, 2013 at 09:44 AM 0
Share

So there are no export settings to change the bone direction, like the .fbx export settings can change the model direction?

avatar image Fattie · Apr 08, 2013 at 10:01 AM 1
Share

I don't use blender, and I am not a modelmaker anyway.

If you mean export settings in Blender I don't know, ask a Blender expert.

I'm fairly sure you have to just properly rebuild the model ... from scratch ... I've heard my modelmakers complaining about doing this constantly, there's no way around it.

(the SCALE issue is very similar .. it is true in unity import you can change the scale; but that sometimes is not a solution. with the "z forward" issue there's just NO way around it. all game production is z-forward.)

avatar image alexanderflink · Apr 08, 2013 at 11:00 AM 1
Share

If this is the case, then the model will have to be redone. I guess i'm lucky to find out now and not later. :)

avatar image alexanderflink · Apr 08, 2013 at 11:01 AM 1
Share

Okay, well I guess i'm lucky to find out now and not later. Thanks. :)

avatar image LunaArgenteus · May 09, 2014 at 03:44 AM 0
Share

This isn't about modeling though . . . it's about rigging - the bone armatures themselves have a bizarre error when converting from blender's coordinate system (which is both z up AND right handed) to Unity's (which is both y up AND left handed).

I'm looking for a solution to this myself right now . . . it might be possible if you could manipulate the axes of the bones, but everything I've seen so far suggests that you can only adjust the bone roll - that the axis the bone is facing will ALWAYS be the local y axis in blender. THAT is the root of this particular problem.

This is probably super late for you, but maybe it'll help someone else. If you're relying on scripts to modify your bone rotations, you can create a quaternion that acts as a correction to the coordinate system, and multiply it to whatever rotation you want to transform your bone by, then multiply the result to the inverse of your correction quaternion. This is what I've been doing for my case thus far, and while it works fine, it'd be nice to find some way to correct the armature before it gets into Unity.

EDIT: Alternatively, you can just apply the correction quaternion directly to your forward, right, and up axes when you use them to calculate your resultant quaternions (and you don't need to multiply your results by the inverse afterwards). Whichever makes more sense / is easier to use for you.

4 Replies

· Add your reply
  • Sort: 
avatar image
4
Best Answer

Answer by Fattie · Apr 08, 2013 at 08:32 AM

Is what you're asking: you must model in z-forward. It's an absolute basic in video game production.

It's a pain, but the model would have to be redone.

There are silly workarounds, but they're silly. Every model you import in to Unity has to be z-forward

Even experienced studios screw this up sometimes: A good example is: on a car model, every little piece of the car, must be z-forward. For example with the left-right wheels/tyres, you cannot just flip-em arround, the right and left must be each individually z-forward.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
1

Answer by Lugen · Nov 16, 2013 at 07:44 AM

For getting the mesh to align according to Unity axis just rotate it in Blender to face the right axis and then reset the transformation. Ctrl+ a is the default hotkey.

Not entirely related to your problem I know but I had to mention it since the comments about rebuilding the model from scratch just sounded completely ridiculous.

Now I'm not sure about the armature itself as I'm looking into a similar issue myself. In my case I want to parent various objects to bones and have them match the orientation. So far I've only found the above mentioned workaround.

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Deon-Cadme · Jan 16, 2014 at 12:05 AM 0
Share

@Lugen: I was also fighting with parenting today (completely new to Unity and Blender), my became to add an extra bones for attachements.

$$anonymous$$y case was; I wanted to attach hair to the head but it ended up in the neck area because of how Unity works (wrong end of head bone).So I added a hair bone to the head that I could use to manipulate the position ;)

The benefit with these extra bones is that we can parent objects to the skeleton while manipulating the child and not affect the parent. Example, I can now spin the hair around or make it jump around without manipulating the head bone.

avatar image
1

Answer by bidjo666 · Jul 15, 2020 at 06:40 PM

In FBX export settings select Armatures Primary Bone Axis select Z Axis Secondary Bone Axis select -X Axis

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

Answer by vladibo · Jul 02, 2016 at 09:59 PM

I have found that modifications on model level are too labor intense and the cost of wrapping it with artificial parent transform is too small to be a problem, so I just wrap it in an artificial game object

 var currentHolder = new GameObject(current.name+"_Holder");
 var holder = currentHolder.transform;
 holder.position = current.position;
 holder.LookAt(holder.position + desiredWorldForward,worldUp);
 holder.SetParent(current.parent);
 current.SetParent(holder);
Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

16 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

How to create hip and chest bones like the "dude" model has? 0 Answers

Why does Unity rotate my bones around their centers? 1 Answer

twisted models 1 Answer

Is it possible to edit an armature once it is imported into Unity? 1 Answer

Blender to Unity: Surface shading issue with bones 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges