[Novice] Footstep Line Drawing OnClick
Hey guys, Im a pretty novice unity user, and I want to make a program that pretty much follows the mouse clicks to draw a line that's gonna be used as a path (as in drawing one's walking path on a map). What I tried is make an object and instantiate it on mouse click again and again (I know its terrible designing idea, but im still starting so that was the best I could come up with so far, I havent been able to work with Linerenderer) Using it with a circle makes a fine line, and for the time being I could even make do with that, but I really want to try and make it more fancy, so I tried to do it with a 2D sprite with RigidBody2D and CircleCollider2D, and destroy the colliding sprites. But my problems are ofcourse the collision moves the footstep sprites a bit before the destruction which makes the line feel clunky, also the footsteps always look in the same direction (obviously) and I think a bit of work is needed to make them on the correct angle every time, etc. So, I would really like some help on how to approach the problem better, or even some help with my own approach if it's worth it. Below are some screenshots of drawing the same path with the circles and the footsteps, and my code


void Update () {
mousePos = Camera.main.ScreenToWorldPoint(Input.mousePosition);
mousePos.z=0;
if(Input.GetMouseButtonDown(0))
{
isMousePressed = true;
}
else if(Input.GetMouseButtonUp(0))
{
isMousePressed = false;
}
// Drawing line when mouse is moving(presses)
if(isMousePressed)
{
Instantiate(Dot, mousePos, Quaternion.identity);
}
}
Thanks in advance!!
Your answer
Follow this Question
Related Questions
OnMouseOver not work when instantiating camera 1 Answer
Instantiate PreFab on trigger location 0 Answers
Instantiating prefabs problems. Check the description 0 Answers
Instantiate onMouseDown 1 Answer