- Home /
How to create a Circle around object ?
Hi guys , i have some scanner models in my scene and i need to create a circle that shows the distance from the scanner (attachment).... so i also need to have the option to scale the circle any ideas ?? thanks
Is the circle to be drawn in game, or is this something you want to use in the editor?
Is the circle meant to be appear as a GUI element or should it exist in 3D space? If it's the later case, should it be painted on some other gameObjects or should it float on its own? Should it always face the player or act independantly of him?
One possible approach could be a plane with a transparent texture of the circle. You would simply need to scale the plane to change the circles size.
Answer by mhtraylor · Apr 05, 2013 at 09:53 PM
You could create another GameObject (such as a flattened Cube or some custom low-poly Plane) with a transparent material and circle texture, and parent it to your scanner object. Then you can access it in script and modify its local scale, position, etc. like so (this script spins the circle and scales it based on input):
using UnityEngine;
public class TestScript : MonoBehaviour
{
Transform circle;
public float scaleSpeed, rotSpeed;
void Awake()
{
circle = transform.Find("Circle");
}
void Update()
{
float dxz = Input.GetAxis("Vertical") * scaleSpeed * Time.deltaTime;
circle.localScale += new Vector3(dxz, 0.0f, dxz);
circle.Rotate(Vector3.up * rotSpeed * Time.deltaTime);
}
}
Here's what mine looks like:
There's a TERRIFIC asset on the asset store called "Dynamic Circles"
You should get it for sure - it's only a couple bucks and it's great
Your answer
![](https://koobas.hobune.stream/wayback/20220613095754im_/https://answers.unity.com/themes/thub/images/avi.jpg)