Hi! I am making an avatar editor, and I have run into a problem.
I want the player to be able to select a piece of clothing to edit by clicking a circular button on the avatar window. The circles should line up with the body of the avatar (one for hat, one for face, one for gloves, etc.)
The window I created by having a camera (that looks at the 3D avatar) render to a texture (600x800 px) and then creating a RawImage on the canvas.
That camera I also use to convert points of interest (clothing locations) to canvas space, but something is wrong with it.
Any help would be greatly appreciated! 😊
Here is my code for moving the UI circles:
Vector3 circlePos = cam.WorldToScreenPoint(circleTargets[i].position);
// Convert to 0-1
circlePos = new Vector3(circlePos.x / characterCamTexture.width, circlePos.y / characterCamTexture.height);*/
// Stretch to window size
circlePos = new Vector3(circlePos.x * characterWindow.rect.width, circlePos.y * characterWindow.rect.height);
// Move to window space
circlePos += characterViewBottomLeft.position;
uICircles[i].position = circlePos;```