So I am trying to orient a gameObject ( house in the picture below) which is nothing but a plane and has a 2d texture on it as you see below. The whole game is made on a hex sphere. I am using Orthographic camera projection for this game. I have oriented the house plane to the normal of the tile and rotated it by 90 degrees in x axis to begin with
cityDummy.transform.rotation = Quaternion.LookRotation(normal); cityDummy.transform.Rotate(90, 0, 0);
Now I am trying to orient the house to make it look at the center ( blue capsule object in the image is the center point ) but I don't want to rotate it in all angles. Basically that is what LookRotation or LookAt does inside Unity. So after orienting the house with the normal, how do I make the house object look at the center and just rotate it in one axis that would be the y-axis in this case?
The reason why I need to do this is first of all I want to orient the house texture to the normal of the tile it gets placed on as you see in the image above. That works fine.
Now the next thing is we want them to face the south which is the blue capsule in the image above. So they would still be oriented like in the image below but the forward of the city should be facing south or towards the blue capsule. If I do LookAt it messes up the current orientation as it rotates in all axis. I would only want to rotate it on one axis and make it face the capsule