playMaker

Author Topic: Set/lock mouse cursor  (Read 5209 times)

tim.holman

  • 1.2 Beta
  • Playmaker Newbie
  • *
  • Posts: 49
Set/lock mouse cursor
« on: October 25, 2011, 10:49:40 AM »
I'm using a reticule in the center of my screen as an aiming marker (it's in first person), and I have set the cursor and locked it, which works great. Here's the problem... after I pause and then unpause the game, the reticule will not stay locked in the middle of the screen! It moves freely about the screen and the player can freely move around the level as well. As soon as the player left clicks again, the cursor locks itself back into place as it should be.

My question is, how can I ensure the cursor stays locked in the center of the screen without having to click when I come out of pause? I've tried placing the Set Mouse Cursor in several different states, but nothing seeems to work. Any ideas how to solve this dilema?? Thank you in advance!!

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 3987
  • Official Playmaker Support
    • LinkedIn
Re: Set/lock mouse cursor
« Reply #1 on: November 05, 2011, 02:36:25 PM »
The NoExit sample handles this correctly if I remember correctly (not looking at it right now). I believe it uses a central CursorManager FSM that just handles cursor state. You can send events to this CursorManager to lock/unlock the cursor, change its visual state etc.

tim.holman

  • 1.2 Beta
  • Playmaker Newbie
  • *
  • Posts: 49
Re: Set/lock mouse cursor
« Reply #2 on: November 10, 2011, 01:45:42 PM »
I've set up a cursor manager that is identical to that of the NoExit scene, the only difference being the actual textures used. I have ensured that "Lock Cursor" and "Hide Cursor" are checked (although I've tried leaving "Hide Cursor" unchecked, but still get the same result... I'm still a little fuzzy on that). I've ensured that there are no "Set Mouse Cursor" actions in any other state except the CursorManager.

As I look at the CursorManager FSM at runtime, it seems to be reacting as desired. Global events are sent from other Fsm's, and the state is changed accordingly. However, even when it's in the "DefaultCursor" state where "Lock Cursor" is checked, it refuses to actually lock (until left clicking once).

I've also been having this problem in builds. When I first start up the build, everything works fine. After I pause and unpause, however, the cursor doesn't have the applied texture, just a normal cursor that won't lock in the middle of the screen.

Any suggestions would be greatly appreciated!!