Indefinite Scrolling Using Mouse Position

I’m trying to create a similar camera to that used in Eve Online, where I can hold down RMB and drag to ‘spin’ around the ship. Everything works fine but I have one problem - when I click on the viewport window, the amount I can spin is limited by where the (hidden) cursor reaches the screen edge. Before I click the window, I can spin freely, the cursor reappearing at the screen edge when I release RMB. Event graph below:

Is there a better way for me to achieve this than I’m doing? One that allows me to spin infinitely as long as the mouse is moving?

Perhaps there is a better way, but maybe try saving the mouse location when you enter rotation mode, and then set the mouse location to that inside your mouse axes is camera rotation active branch

just a brainstorm idea, but maybe instead of position you can use the mouse delta and direction. e.g. how fast is the mouse moving, and in what direction?

1 Like

That’s what the Mouse X and Mouse Y nodes return as a matter of fact, they don’t return the actual position of the mouse

1 Like

Thanks for the replies! Ok so I’ve cobbled this together which is now remembering the pointer location (something I wanted to happen anyway as it so happens) but hasn’t made any difference to the viewport edges limiting the camera spin. I’ve noticed that if I just turn the mouse cursor off completely, I can spin freely regardless, but the moment I make the cursor appear and click that window, it’s over from then on out.

Ok another odd observation: if I hold left click (which isn’t bound to anything) as well as right click it spins freely. I can even then let go of left click and I have unrestricted spinning UNTIL I let go of right click and the cursor reappears. Then it’s back to restricted…

Try calling the set mouse position inside your Mouse X or Mouse Y

Nice! This seems to be working fundamentally, although there’s a couple of things I might need to work on - firstly if I move the mouse too fast it sort of gets stuck at the edges, I assume due to some discrepancy in how quickly it can ‘reset’ the cursor position. Secondly, having the mouse remember it’s starting position actually feels really odd (not what I was expecting).

I’m going to mess around with these for a while and report back, but feel free to make suggestions in the mean time.