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.

Changing Controls

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.
UCLA.RES.
Member
Member
Posts: 18
Joined: August 23rd, 2011, 1:11 pm
Name: Daniel

Re: Changing Controls

Post by UCLA.RES. »

I am not using Lunix, so I had to do trial and error. I only got error.
arcones
Support Team
Support Team
Posts: 2734
Joined: January 13th, 2010, 12:42 pm
Name: Timothy
IRC Username: I use Steam
Location: Looking over your shoulder...
Contact:

Re: Changing Controls

Post by arcones »

Code: Select all

Index: src/engine/rendergl.cpp
===================================================================
--- src/engine/rendergl.cpp	(revision 3240)
+++ src/engine/rendergl.cpp	(working copy)
@@ -852,6 +852,9 @@
     while(camera1->yaw>=360.0f) camera1->yaw -= 360.0f;
 }
 
+int moveentropy = 0;
+VARP(mouselook, 0, 0, 1);
+
 void mousemove(int dx, int dy)
 {
     float cursens = sensitivity, curaccel = mouseaccel;
@@ -880,13 +883,25 @@
     }
 
     camera1->yaw += dx*cursens;
-    camera1->pitch -= dy*cursens;
+    if(mouselook)
+		camera1->pitch -= dy*cursens;
+	else
+		moveentropy = clamp<int>(500, -500, moveentropy - dy * cursens * 2);
+
     fixcamerarange();
     if(camera1!=player && !detachedcamera)
     {
         player->yaw = camera1->yaw;
         player->pitch = camera1->pitch;
     }
+
+    if(moveentropy)
+	{
+		player->move = clamp(1, -1, moveentropy);
+		int dt = min<int>(fabs(moveentropy), curtime);
+		moveentropy += (moveentropy > 0) ? -dt : dt;
+	}
+	else if(!mouselook) player->move = 0;
 }
 
 void recomputecamera()
The top part that says src/engine/rendergl.cpp is where this bit of code needs to go. If you've already got it there, that's great, you probably need to compile the engine though.

If you don't have it there, that's where the file should be. Either the rendergl.cpp file is already there and you add this on, or it's a new .cpp file you need to create yourself. (I'm not on my computer or I'd tell you which it is ;D ) Then compile.
Image
Want a user bar like this one? PM Leo!
UCLA.RES.
Member
Member
Posts: 18
Joined: August 23rd, 2011, 1:11 pm
Name: Daniel

Re: Changing Controls

Post by UCLA.RES. »

wait, so I just put it anywhere in that file? also, how do I compile it with the engine? i tried the directions posted on wiki, but it didn't work. You are so helpful. I am so close!! Please stick with me!
arcones
Support Team
Support Team
Posts: 2734
Joined: January 13th, 2010, 12:42 pm
Name: Timothy
IRC Username: I use Steam
Location: Looking over your shoulder...
Contact:

Re: Changing Controls

Post by arcones »

Place it at the end of the file. So you did this?
To compile go into src\windows and open the file named sandbox.cbp. This should start codeblocks.
if this is your first time, codeblocks will prompt you over which compiler to use, it should auto detect the presence of mingw under 'GNU compiler collection'. If not please make sure mingw is installed correctly.
To build the binaries, simply click the build button and codeblocks will take care of building everything.
And used the appropriate programs? i.e. codeblocks and mingw?
Image
Want a user bar like this one? PM Leo!
UCLA.RES.
Member
Member
Posts: 18
Joined: August 23rd, 2011, 1:11 pm
Name: Daniel

Re: Changing Controls

Post by UCLA.RES. »

I don't think you are supposed to put it at the end.

Because I am using Windows and not linux, those instructions don't work. Still, I tried anyways and it didn't work. I am getting desperate, because no matter what i do, its not working. My research leader is not getting frustrated with me and its not a good situation. Would you be able to help in another way possibly?

Thank you
Hirato
Developer
Developer
Posts: 689
Joined: May 30th, 2009, 1:23 pm
IRC Username: hirato

Re: Changing Controls

Post by Hirato »

This is probably a bit late, but I committed a more "proper" patch into sandbox.
I've updated the bianries so you don't have to compile, just follow instructions here
http://www.sandboxgamemaker.com/wiki/in ... evelopment

one that is done, run the FPS module (I only added it there) and type /mouselook 0
This is not a url, clicking it is pointless
Locked