Unity - Child Rotation and Scale error - unity3d

I'm saw some wierd responses from Unity when I tried to do these actions :
1- I've created a Plane, simply rotated it (-32,-19,-56) and scaled it (3.21,1,2.43)
2- I've created a child cube for that plane and rotated it (-30,39,-78) and scaled it (3.54,4.8,6.42)
This is the final result in editor :
Did I do something wrong???
Why collider and renderer performing differently??
Is this a Unity bug? I'm currently using Unity 2017.3.1p1

Yes, it is some kind of bug.
To avoid it, don't child the objects directly to a non-uniformly scaled parent. Instead, child this non-uniform object (the cube) to an empty object, which will be the parent of the plane too.
Since an empty object is scaled 1,1,1, childing other objects to it don't cause this problem.

Related

Unity Arfoundation placed object is not static

Added FeatheredPlanes scene from samples to my project.
The problem is: when the content
https://gyazo.com/685b86f10b01e734dac14d57ee7a022e
is per-defined (set the cube or any object before building) - everything works fine.
When the object is set dynamically, my object is loading from the server and then is setting to the "content", then after placing it to the virtual plane - it starts to move if i move my camera.
The problem was model's pivot point.
It was at the center of the model, and all i had to do, is to offset the model, so the bottom part of the model is leveled with the floor.

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.

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

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.

Sprites reshape unexpectedly

Using Unity 4.6.0 .
I've imported some sprites to my project . I attached an image of one of these sprites (It's only a prefab with SpriteRenderer Component attached to it)
But sometimes Unity reshapes the sprite automatically
And if I change some settings of these sprites like Max Size or Format, then the sprites will be rendered correctly but after a while it will be reshaped again! I don't have any idea about this problem.
This can happen when you parent your sprite to an object that has a scale other than (1, 1, 1). If any object higher up in the hierarchy is scaled it will affect all children including your sprite.
You can either counter the scaling or use Transform.SetParent to do it for you.

Rotating Derived Objects in hierarchy scales them?

For an assignment I was told to experiment with the Unity hierarchy by making an amusement ride. I created a surface that moves up and down that works fine. When I add new objects to the surface that moves up and down and attempt to rotate them they also scale at the same time. I'm not sure why this happens. I have tried making them outside of the root object then adding them in but it does the same thing. If someone could give me a hint as to what I'm doing wrong that would be awesome.
If they scale right in the moment when you add them to the surface, then you probably scaled the surface before. In an object hierarchy all objects inherit the transformations of their parents.
You can avoid that by creating your tree with empty objects and only attach the visible objects as leafs.
Instead of doing it this way (which will result in the sub-objects beeing scaled according to the scale of the surface):
Surface
+SubObject 1
+SubObject 2
You can do it that way:
EmptyObject (scale 1)
+Surface
+SubObject 1
+SubObject 2
That should solve your problem