Uhhmm sorry Unity Heads I forgot to include the code for rotation ;) ,now I have and also a link to a UnityProject with a Problem Demo(see below)!
I have problems with a rotation on an imported mesh in a deep child structure.
A parented mesh should rotate with its parent but keeps facing up the Y Axis, I do this by having a simple script like...
function Update(){
//
transform.up = Vector3.up;
}
...and the code for the rotation is:
function Update(){
//
if(Input.GetMouseButtonDown(0))
transform.Rotate(0,0,90);
}
...this is no problem the rotation works like it should, but the position of the child is changing in an unwanted manner(not holding parents position).If I remove the script the position is where it should.
So I swapped myMesh with a standard Unity Cylinder, and the position problem disapears. My first thought was it is a non-uniform scaled mesh, and I exported it again.
Same problem with the position, then I checked(more than once)...
- Pivotpoints
- MeshScale
- Different exportformat(.obj, .fbx)
- put mesh in an emty GameObject
...with no effect.
If it is a non-uniform scaled mesh how can I 100% identify it, or what could it else be?
I build a little project to demonstrate the problem.
The project has two Scenes one with MyMesh where the problem occurs(MyProblemScene), and a Scene with a UnityMesh(MyWorkingScene).The rotation is done via Left Mouse Button.
Download the project: Fast Files - Free File Hosting
File Name: RotationTest.rar
File Description: Unity3 3ProblemDemo
File Size: 157.77 KB