Proper way of getting mouse or touch delta to control camera rotation

Hi guys, I’m trying to make a first person camera rotate properly, what would be the best way to get the mouse or touch delta?

Original Post on Discord

by user 262331051802755072

Using this method should help: this.context.input.getPointerPositionDelta(0);

understood! would this work even if the pointer is locked?

by user 262331051802755072

Not sure to be honest

Just debugging that - it’s not handling that case correctly. Next update will fix that later today :slightly_smiling_face:

Can you try with this version? Discord

will try @marcel :cactus: thanks, also a related question, I’m testing the camera on iPad and the screen doesn’t react to touch as it does to mouse on pc, what I mean is the screen in all the examples works as if the game window was fullscreen, on iPad it’s working as if when touching I was dragging the whole page and the pointer is unusable, could you point me in the right direction? tthis is the glitch build

by user 262331051802755072

Are you using the getPointerPositionDelta method above? I think its not implemented for touch - I need to check that

yes, I am using getPointerPositionDelta, now I’m intrigued as to how to handle the mouse vs touch, pointer seemed like a way to handle both

by user 262331051802755072

Yes it should - touch does get through the pointer info, I’ll test in a bit.

Btw the description sounds a bit like something on top might be blocking the pointer event on iOS? Is that possible?

not sure, I’m testing from the glitch link I shared here

by user 262331051802755072

Does local dev not work for you for some reason?

yes it does, but I’m not the only one testing it so it makes sense via glitch

by user 262331051802755072

Ah i see ok :slightly_smiling_face:

You can use the same local ip address if you’re in the same network btw (just in case you didnt know :smiling_face:) - but I guess that’s not the case

actually went ahead and tried local and got an error I had not seen before:
Failed to execute ‘define’ on ‘CustomElementRegistry’: the name “needle-engine” has already been used with this registry.
Local isn’t working for me on this project

by user 262331051802755072

I think this happens when vite has a hiccup - try restarting the server


by user 262331051802755072

Is there a server still running by any chance?

no, but glitch export does work

by user 262331051802755072