- Home /
Question by
WolfTraits · Feb 14 at 04:09 AM ·
cursorfollowmove an object
Trying to make an object follow my cursor
I'm using csharp, and I'm trying to make "StaticObject" follow my cursor. Is there something wrong with my code or do I need to try a new method?
public class Cursor : MonoBehaviour { private Vector2 StaticSprite; void Start() { StaticSprite = new Vector2(0.0f, 0.0f); }
// Update is called once per frame
void Update()
{
Vector2.MoveTowards(StaticSprite, Input.mousePosition, 30f);
}
}
Comment
Answer by codevisionary005 · Feb 14 at 08:58 AM
https://answers.unity.com/questions/1076409/how-to-make-a-game-object-follow-the-mouse-cursor.html see if this can help you.
Your answer

Follow this Question
Related Questions
How to make an object orient to the mouse direction 0 Answers
object follow mouse position in 3d world. 1 Answer
Texture following cursor... 1 Answer
Make GameObject match the position of mouse cursor? 0 Answers
Set borders to mouse follower? 0 Answers