Size of Gizmos shere not equal to value

Hi everybody :smile:

I’m using a Gizmos.DrawSphere to draw on my scene the area where my monster can move.

To draw my sphere i’m using:

    void OnDrawGizmos()
    {
        Gizmos.color = Color.yellow;
        Gizmos.DrawSphere(transform.position, 2);
    }

and to get a pos for my monster :

Vector3 postest = spawnPos + new Vector3(2, 0, 2);

In my script above, I put the value of “2” for the size of the sphere, and also in X and Z for my monster.
With that, I expect to have my monster at the edge of the sphere.
But not at all …

Here what I have:

Just in case, The “spawnPos” is the Guizmo object…

If someone can explain to me what is happening?

I tried with bigger valu and the result is the monster always goes 30% further than the edge of the sphere…

Thanks for helping me!
Have a good day!

Putting 2 for both your X and Z values gives a greater value than 2 of a distance…

The distance it will be at is Mathf.Sqrt(Mathf.Pow(2, 2) + Mathf.Pow(2, 2)), or about 2.83.

1 Like

@RadRedPanda

Thanks to you ! I check with only “2” on the X for the monster pos, and effectively the monster stay at the edge of the sphere ^^

I understand now! :smile: Thanks for your help!