- Home /
Touch / Mouse tracing
So i and a few friends are currently working on a game that records where a mouse or finger goes and then uses it later.
Example would be in paint, the mouse moves around (while clicked) and a line following the mouse is created, i want something like that, but rather than creating any line or anything, it simply stores the entire movement for later.
Answer by Eric5h5 · Oct 09, 2013 at 03:59 AM
Make a class that consists of a Vector2 and a float. Then make a List of this class, and every frame you would add the current mouse/touch position (the Vector2) and the time (the float). You may also want to add a check to see if the mouse position has changed since the last frame, and if not, don't bother storing it.
Ah, thank you (Unity never emailed me about your comment) How would you suggest using the stored vectors/floats to move an object?
Your answer
![](https://koobas.hobune.stream/wayback/20220613115558im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Ragdoll 2D character controller help 0 Answers
How to make this buttons for Android? 1 Answer
Replace Touch commands with mouse events 2 Answers
Right Mouse Click in Android 2 Answers