- Home /
Mouse cursor position shared beetwen different builds.
Hello! I'm making 2D multiplayer game and I currently have the game mechanics and client-server structure. Everything works just fine, I'm synchronising position, rotation and it's perfect. The thing is that when I test it I have two different windows on left and right side of the monitor (client/server) and one of them is always not active (I "play" only on client for example and look what's going on on both) but the cursor position is always being read on both of them.
I'm looking for function that would block this behaviour. Something like: if (windowIsActive) -> rotateTowardsMouse.
Thanks for any help!
Answer by TechKnowledgey · Nov 15, 2015 at 10:34 PM
You could try getting the total screen width or screen height (depending on how your monitors are set up) and dividing the value by two, depending on which half it is on then you could use your "rotateTowardsMouse" function.
Let me know if I misinterpreted your question.
Answer by Eno-Khaon · Nov 16, 2015 at 01:02 AM
You may want to look into OnApplicationFocus() for this. It returns true or false dependig on whether the window gets or loses focus.
Answer by meat5000 · Nov 16, 2015 at 01:18 AM
You could create a UI cursor and read the position on this instead.
Your answer
Follow this Question
Related Questions
Rotate plane on a pivot to the mouse position (in 2D) 1 Answer
I need help with clamping a rotation towards the mouse position 2 Answers
object rotates toward mouse? 2D Top Gameplay 6 Answers
Why Rotate player toward mouse direction keeps increasing rotation speed? 1 Answer
Following the mouse Cursor does not work correctly after Flip() Function 0 Answers