0
$\begingroup$

I am having real problems and am very new to blender/unity. Right now I have a script that resizes and creates variable longer blocks from a basic cube in unity. I won't show the script as that might not be relevant but this is the result when the script is run to give you an idea -

enter image description here

The original prefab is the default unity cube but the script scales it, etc.

I am trying to replace this cube prefab with an altered cube (a cube with the top right and left edges cut off) to create variably-sized platforms such as this -

enter image description here

I am very new to 3D and so started by just created a simple modified cube in blender -

enter image description here

When I drag this cube into unity it shows up well however when I plug it into my script it elongates the cube in the wrong direction, etc. I know the rotation is off, so I tried to fix that first by rotating the object in blender (this did nothing) and then creating an empty Gameobject and rotating the object there as Unity says, but nothing is working.

In addition to rotation I think the scale of the blender cube is much bigger than unity cube. Furthermore I do not know how to add colliders or other components to my blender object if I just import it- seems I have to drag it into an empty first or the options are all grayed out. Mostly I think I just don't know how to properly import from blender to unity despite tutorials.

This is what happens when I run my script as opposed to original picture -

enter image description here

Clearly a lot is going wrong here. I just want to replicate the default unity cube in blender and modify it so when I bring it back to unity I can use it in my script. How can I do this? What am I doing wrong?

$\endgroup$
1
$\begingroup$

Yes, Blenders scale is different, if you are using FBX (which i would recommend for Unity likes it), there is an export options called: Apply Transform (Experimental!). This works for me, otherwise, scale your final mesh down to compensate (Unity's scale is 100x smaller, so it makes the cube's scale 100x100x100, you can also adjust the mesh import scale in Unity, instead of compensating in Blender).

In Blender, if you make any changes to the rotation in object mode, you need to apply that rotation (CTRL - A) before it exports it. Also, the reason the rotation is wrong is due to Unity using the Y axis as its up axis, and for Blender this is Z. You can compensate by making the up axis of your mesh the Y axis in blender. See posts like this for more info: http://answers.unity3d.com/questions/174832/stopping-the-270-degree-fbx-default-rotation-on-im.html

If you are still experiencing issues something is going wrong in Unity, and you should post the issue in the Unity section, with your script included. And good luck and have fun learning!

$\endgroup$
  • $\begingroup$ I really need some help. I am not using fbx i am just saving my .blend file into unity. I think the scale isn't a problem anymore its just rotation. I've watched all the tutorials and again I've rotated my object to have y axis up in blender but nothing is working. What would you suggest? $\endgroup$ – skyguy Jun 20 '16 at 15:56
  • $\begingroup$ Just to be clear, are the custom cubes scaling wrong or not scaling at all? For you say it scales it wrong, but from the picture it appears they arent scaling at all. The only problem i can think of off the top of my head is that maybe you are scaling in the wrong space (local / world). Or maybe Unity handles cubes weird when importing .blend, you could try making only the cubes .fbx (never imported .blend in Unity myself.) $\endgroup$ – Dennis Jun 20 '16 at 22:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.