Im trying to make a little circle and under my character that follows him around ....Its similar to sports games where a player that is selected has a circle under him ...Any suggestion about how to do that in C#?
Thanks
Im trying to make a little circle and under my character that follows him around ....Its similar to sports games where a player that is selected has a circle under him ...Any suggestion about how to do that in C#?
Thanks
The highlight itself is not really something that you'd do in code for several reasons.
A child projector that ignores the player's layer would be the simplest way to do it.
You could also do it with a child line renderer with points laid out in a circle.
You could even create a very short child cylinder with a material that uses alpha and has the highlight mapped to the exterior of the cylinder.
If you wanted to script something to follow the position of something else with an offset like always above or below without worrying about parenting, you could do something like:
using UnityEngine;
public class Follow : MonoBehaviour {
Transform target; //the target to follow
Vector3 offset = Vector3.zero; //the amount to be offset by
void Update() {
if(target) transform.position = target.position + offset;
}
}
If the ground is utterly flat you might be able to get away with just attaching a child GameObbject (which is the circle) to the player's GameObject. Set the transform to positon it around the player's feet. Then you can use one of the transparent shaders to give is a translucent, glowing effect.
No code is required for the above. In code you can easily deactivate the object or it's renderer whenever you want to turn the circle off.
If the player is walking on something uneven like terrain, you will have to do more work. But again, code might not be needed. skovacs1's suggestion about using a projector looks like a good solution. See the Projector overview in the Unity docs to see what he's talking about.