Hi! Welcome to the forum for Platinum Arts Sandbox Free 3D Game Maker. I currently have the forums locked as I am attempting to properly update them.

In the meantime please join the new Discord Server!

If you have any questions please e-mail me through the Platinum Arts website.

Restricting X-Axis mouse movement

Having issues not related to a specific Sandbox game mode? Get help here!
Please also read the rules for support when posting support requests.
Failure to comply with the forum rules may result in your topic being locked without resolution.
Locked
wishfulscientist
Member
Member
Posts: 16
Joined: February 26th, 2013, 3:40 pm

Restricting X-Axis mouse movement

Post by wishfulscientist »

Hi all,

Is there a way to restrict (eliminate) a player's mouse x-axis in game or through .cfg file editing? Or is it simpler to do it through programs in Windows?

Thanks much!
wishfulscientist
Member
Member
Posts: 16
Joined: February 26th, 2013, 3:40 pm

Re: Restricting X-Axis mouse movement

Post by wishfulscientist »

I tried using an authotkey script that works wonderfully in windows explorer:


YOUR FAVORITE KEY 1::
Confine := !Confine
ClipCursor( Confine, A_ScreenWidth//2, 0, A_ScreenWidth//2, A_ScreenHeight )
Return

YOUR FAVORITE KEY 2::
Confine := !Confine
ClipCursor( Confine, 0, A_ScreenHeight//2, A_ScreenWidth, A_ScreenHeight//2 )
Return

ClipCursor( Confine=True, x1=0 , y1=0, x2=1, y2=1 ) {
VarSetCapacity(R,16,0), NumPut(x1,&R+0),NumPut(y1,&R+4),NumPut(x2,&R+8),NumPut(y2,&R+12)
Return Confine ? DllCall( "ClipCursor", UInt,&R ) : DllCall( "ClipCursor" )
}

However 'yfk1' locks the cursor up and repeatedly (quickly) switching it on and off seems to make the player spin around the x-axis, whereas it should lock the X axis in place.

'yfk2' shoots the cursor and view upward along the y axis. So they do consistent things, I guess. Something is getting messed up along the way.

Any takers?
wishfulscientist
Member
Member
Posts: 16
Joined: February 26th, 2013, 3:40 pm

Re: Restricting X-Axis mouse movement

Post by wishfulscientist »

Figured it out using Autohotkey as before, modifying the previous script. The symptoms of the error were odd, but a huge performance hit while the player was spinning suggested that the computer could not do a particular function, but was trying. I manually specified 2 pixels in the middle of the screen and found that the cursor won't move in explorer (good news! it's being confined within them) and this method works in game. So the computer just needed a specified, feasible boundary.

Hope that made sense.
Locked