displaying a circle

Hi everyone,

to learn unity i fixed myself a goal: being able to built a simple tactical/rpg prototype. Nothing fancy just the basics.

To represent the distance a character can travel during his turn i chose to display a circle around him that will shrink the more he move. If possible i would like the circle would be directly drawn on the character environement (the flour, stairs, even crate or barrel in range) it would be outlined and have a semi-transparent color but that far from important.

But here is the probleme : I’m noob ^^ and i didn’t find any tuto that would allow for 2d procedural drawing. So i don’t ask for a ready to use snippet (i would take one if you happen to have one ^^) but just a sign in the direction of the function thta could allow me to do that.

I already thinked of 3 way to evade the problem: using particle but the way i think of doing that wouldn’t have the good appearance, using a colored cylender but that would be to different or using an image and play with the size but if the circle become really huge some kind of aliasing effect will probably appear.

So that’s why i would prefer to stick to the original solution I have chosen.

PS: sorry if i speak weirdly or make strange orthographic mistake, still need to work on my english.

I’d recommend using a projector with a circle texture. You can see some examples with the “Projectors” standard Unitypackage.

–Eric

Thx i’ll go look at thta right away.

edit: not exactly what i had in mind but that will do. Just one tiny problem : how do i know the “size” of the projection? I could do some test and deduce a simple equation from that but maybe someone already knowhow to calculate with the attributes of the projector.

On the projector’s properties, turn on ‘Orthographic’. Then the Orthographic Size is the radius of the projected texture.

Perfect, i had understood that an Orthographic projector had a constant size but couldn’t find where to customize it. Thx a lot.

EDIT:

maybe i still don’t understand correctly how to access property of game component but i can’t acces the “Orthographic Size” of my projector with my script. Here is what i do :

pro = GameObject.Find("DistanceLightProjector").GetComponent("Projector")
here i should put the name of the propertie that is “Orthographic Size” but when i do i got an error.