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 9761-capture1.png any ideas ?? thanks

Is the circle to be drawn in game, or is this something you want to use in the editor?

in game during runtime

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.

1 Answer

1

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