I got some answers from the forum and tried them all. Still doesn’t work. I need to make the blades rotate, however it always rotate around some axis that is far from center which causes the blades far from the center.Pig.transform.Rotate(Vector3.forward*(Time.deltaTime)*100);
I know this should be simple, but it just doesn’t work. Also, I found something interesting. In the inspector, the position doesn’t change at all though it should change. See the image.
Transform.Roate will not change position. It only changes the rotation of the object around its local origin, just to clarify your comment about why the position doesn’t change in the inspector.
The key is the object’s origin. The local model origin of an object (called the pivot) like this should be the geometric center but probably on the inside (back side) of the cap. There’s a button on the top left of the editor (two buttons side by side). They say Pivot/Center and Local/Global. If you select Pivot Local, you should see the arrows of the blades right in the center of the cap somewhere. If the arrows are far outside this, when you rotate the blades, they’ll rotate around those arrows (that’s the model origin). You should play with these buttons and learn to use them, they will save you a lot of heartache.
There are three ways to fix this. 1) Re-export from the modeling software with the pivot point set to the cap of the blades. 2) Create an empty game object at the cap in the root of the scene hierarchy, drag the blades into that game object, and then rotate that game object instead of the blades. 3) Get a pivot modifier script from the asset store or write your own, and use it to move your pivot in the editor and re-save it.
EDIT: My answer is assuming your pivot is not located properly. If it is, then something else is amiss, maybe the blades are a child of a game object, and you are rotating that game object instead of the blades. Also, you should be able to select the blades, then modify the Rotation values in the Inspector’s Transform. Once you get the blades rotating smoothly, you know you’ve got the correct center. Lastly, in the modeling software, an initial mistake I used to make was selecting all of the vertices/polys and moving them around instead of moving the object itself around. This places the verts off-center (they may all be around +10 for example instead of around 0. In 3DS Max, you can fix this relatively easy with the Hierarchy Modify Pivot panel.
Hi dude,
You must have find the solution, but i run into the same problem and maybe someone else is looking for it too. Actually i made a simple mistake, and took 2 hour to get it since im a beginner.
When you make a prefab listen to the objects position, because the prefab’s pivot will not be where the contained objects pivots are, but in 0,0,0. So if you make a prefab you should listen to where are the object are and move them to the 0,0,0, so the prefabs pivot will be at the center of the object.
Using the two buttons in the upper left corner of the game editor can alleviate alot ot problems and questions. I just wish I found this two hours ago. I am using Probuilder to create complex models and need to exercise the transformers visually.
If you use ProBuilder, you can automatically adjust the pivot.
How do you adjust the pivot in Unity?