Importing an exported .FBX from Blender to Unity object transform issue - unity3d

Alrighty,
I have a dumpster model I have exported from Blender as an FBX. The transform, rotation and scales have all been applied in Blender. when importing into Unity and then adding to the scene, the model is elevated and rotated at an odd angle to the transform as per the image.
The model has an armature for animating the lids an I have applied the location, rotation and scale on it as well.
Any one else come across this or know of a fix?Thanks
Blender image
Incorrect dumpster transform and location image

The problem is that Blender uses the right-handed coordinate system which means the Z-axis is pointing upwards.
Unity uses the left-handed coordinate system which means the Y-axis is pointing upwards.
To fix this, set the X-axis rotation of the model to be -90. Press Ctrl+A and apply rotation. The X-axis rotation will look like it is now 0 after that. Set it to 90 again and export it to Unity.
This 3 minutes video should also help you do this if you are still confused.
If you still have problems, check your animation. Don't apply it to your model and see if it's the problem.

Also as a side note, you can use blender files (.blend) directly with unity. So every time you modify them inside your project folder they change in unity as well.

The simplest way to solve this would be as follows:
Create a dummy game object (D)
Transform/offset the position of D to make sure your object's position align with the dummy parent
Put your game object as the child of the dummy game object D
You can then apply transform on D, rather than your own game object directly.

Related

Blender model Facing wrong direction after exporting to Unity

I want to export my blender model to unity, but every time I do that, my object in unity has a wrong forward direction
I tried rotating the armature to -90 degrees in X axis, then applying the rotation, and then rotating it back to 90 degrees without applying the rotation, but that doesn't help in my case.
One thing that I noticed when trying to fix the problem, is that when other people rotate their objects to -90 degrees, they get their object facing top
But when I do the same thing, my object rotates like this
I've tried importing to unity both as blender file and FBX, and also tried setting forward direction to different axis when exporting as FBX file, but the result is always the same in Unity. I know there is a method in unity of creating an empty gameobject and putting the model in it with right direction, but I really want to fix my model in blender rather than doing that.
Blender has a different axes order.
When exporting, you have the option to export with Y axis up.
Hope it helps.
This is an expansion on Zivdo's answer:
In Blender, +Y is forward and +Z is up (yes, this means we all do our modeling with the model facing backwards), but in Unity, +Z is forward and +Y is up. Thus when creating an exporter, it's simply a matter of swapping the Y and Z values in the vectors (a little more for quaternions and matrices). This is why the fbx exporter has the forward and up options: it takes care of the swaps for you, all you need to do is tell the fbx exporter the correct settings (and maybe ensure your model has the correct orientation (with rotation applied) in blender).

FBX from maya importing to Unity with wrong joint rotation

I'm working on a project that needs to read the joint data from motion capture device to reconstruct the motion.
I already have a model in MAYA where all the joint are having Y axis up-pointed. However, when I import that model to unity, many koints' rotation changed. I've tried different importing method including exporting a FBX then load to Unity and ecpoting to unity directly. I've also changed the default rotation in MAYA from XYZ to ZXY. But the problem still exists.
The mesh will twist since due to the wrong rotation as shown in the picture below. I've googled a lot but still not find a solution.
error listed
Usually the joint direction doesn't matter, though I used to set "z" instead "y" in my character rig.
Please go to your fbx import settings, choose your Rig/Animation Type as Humanoid. Then, create a new avatar Definition from this model.
You should now be able to remap your wrong or missing joints. It's most likely that you have wrong order of character joints' mapping.

Unity all objects have same position

I have a 3d building model in my Unity project. It has many children like doors, walls etc. The problem is, all of the children points to same position in the Unity world (24.97, -2.08, 19.35). Their transforms show this position. And this position is far away from their actual one. How can i fix this?
I tried freeing all children from parent but this didn't change anything.
I want them to show their real position, which appears with move tool when we click upon them.
Here is the image link
It seems that this is simply their pivot point exported "wrongly" from the 3D editor your model was made with.
This won't change until you export it correctly from a 3D editor (Blender, Maya, etc).
Unity is not made for 3D mesh modeling and therefore in Unity itself you can't change the pivot points.
There is a very simple fix
Add a new empty GameObject
In the Inspector go to the Transform component, click on the context menu and hit Reset (you also simply set it to position 0,0,0 rotation 0,0,0 and scale 1,1,1) assuming the pivot should be at 0,0,0
Now drag and drop all objects into the empty GameObject
=> You have now one parent object with correct pivot.
By wrapping it in a parent object the childrens pivots don't matter anymore. You can simply do all translation, rotation and scaling on the parent object with the correct pivot and don't have to care about that "wrong" position at all.

Shift/offset texture used in material on GameObject?

I have a GameObject sphere in my program that represents the Earth.
So I apply a material to it like so:
Using data and a positioning script, I position markers on the globe that represent locations (by longitude and latitude).
Everything seems to work, except that the texture does not line up with the points plotted.
How can I shift the texture so that my data points are on top of the actual locations?
You can see this in the following figure, where South America points are clearly plotted over the ocean between Antarctica and South America in the wrong orientation.
EDIT:
After playing a lot, I found that X offset works, but Y offset does not work. The combination will help me accomplish the task, but it's not wrapping correctly...
To create a new Material, use Assets->Create->Material from the main menu or the Project View context menu.
Drag your texture into the inspector field and change the Offset variables until you get the desired offset result.
You should consider using modeling programs such as Blender for creating textured models or circles but keep in mind if you have textured models it needs to be in .fbx format.

Importing objects form blender to unity correctly

I have recently done few 3d objects in blender and I want to import them int unity3d. I know the basics: that I should export it to FBX file. But I wonder if there are any other things that are very important while exporting to unity? For example where should i position center of my object(near the ground or in the center)?
Typically you want the origin to be the bottom of the character (feet), and another good idea when importing is to make the model a child of an empty object before saving it as a prefab. That parent empty object will then have driver scripts that control stuff like movement and animation.
EDIT: This is one example of why you might want to do the empty parent method, but it isn't directly applicable to your question: http://docs.unity3d.com/Manual/HOWTO-FixZAxisIsUp.html
1) apply location, rotation and scale.
2) set the origin of the model to the bottom.
3) Delete camera and lights