- Home /
Create sprite in place of cursor that has 'lag' on it?
I'm looking to create a script that I can attach to a Sprite which acts as the cursor, but has "lag" on it, so that when the player follows the cursor, he does not immediately jump to the cursor, but slowly moves towards it.
Here's what I have so far...
mousePosition = Camera.main.ScreenToWorldPoint(Input.mousePosition);
transform.position = Vector2.Lerp(transform.position, mousePosition, moveSpeed);
This has the desired effect, in that the character moves towards the cursor, but he does it almost instantly. My moveSpeed is set to 1, and changing it doesn't seem to have any effect.
Any solution to create a cursor that lags would be helpful. I guess if I'm creating another cursor, another question I have is how I would go about removing the default cursor and replacing it with my own, like a dot or target.
Thanks for the help.
Your answer
![](https://koobas.hobune.stream/wayback/20220613140344im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Rotate while moving forward 1 Answer
Gun Projectile Shooting In Wrong Direction (Javascript) 1 Answer
Help with Character Controller 1 Answer
8 directional movement rotation problem 0 Answers
Rotate to mouse cursor error 1 Answer