# Problems with Vectors2 and a Tilting Mouse

Attention Topic was automatically imported from the old Question2Answer platform.

I want a cursor that tilts depending on the direction your moving your mouse. I got it done in construct a long time ago but I wanted to make it in Godot fixing the problems I bypassed with wacky solutions back then.

The hand sprite detach from the mouse position when the mouse starts moving and that’s how I got the angle I needed to rotate the hand and depending on the distance from the cursor the sprite would move faster.

My Idea this time was to take a position in the same direction the mouse is moving but further away depending on the speed of the mouse, then make the hand look at the reference point.

I started by setting the reference point at `get_global_mouse_position() + Input.get_last_mouse_speed()` and it works but the inertia is too strong.

``````func _process(delta):
update()

func _draw():
draw_line(get_global_mouse_position(), marker_vector, Color(255, 0, 0), 1)
``````

I drew a line and realised that even thought draw is called every frame the position of the point is a bit chunky and it doesn’t look as smooth as I was thinking. Lastly when I printed `get_global_mouse_position() + Input.get_last_mouse_speed()` the resulting Vector2 had nothing but integers on both axis. I don’t know if this is the cause of the chunky movement but I can’t come up with anything else.

If i ditch the `get_last_mouse_speed()` method how can I get a vector2 in a direction x distance away from the mouse position

Hi,
I dont get the whole concept. But let answer you the last question:

how can I get a vector2 in a direction x distance away from the mouse position

``````Var result =  mouse_position + direction.normalized() * distance
``````

Where
Result is vector2 a point distance away from mouse in direction
Mouse_position is vector2
Distance is float

There you go

klaas | 2020-08-24 14:59

Normalized works I’ve read more about vectors and know I think I get it normalize makes the vector length 1 and keeps the direction. Unfortunately I came up with new problems I’ll need to read more about vectors.

Thanks for the help.

IHate | 2020-08-24 23:01