Quick and dirty guide to forcing and customizing the ToggleCam

Introduction:
If you’re familiar with PC gaming, you’ll know that Roblox’s default camera mode is a bit of an anomaly. After all, it’s the only game (to my knowledge) that makes you right click to rotate your camera. Others let you rotate the camera simply by moving your mouse. For the longest time, this was only achievable on Roblox via heavy scripting…that is until ToggleCam was released. However, those familiar with toggle cam may notice that the default mode for it is still the rightclick-and-drag. You may have also noticed its rather annoying mechanic of pressing right click to toggle the mode, which makes it hard to use right click functionality in your game. Today, we’ll be going over a quick and painless way to force the camera mode, change the bind for toggling, and modifying the offset.

Step 1:
First things first, you’ll want to get a copy of Roblox’s PlayerModule. To do this, simply press play (or F6 for play in a new window). Once in play mode, navigate in the explorer to StarterPlayer > StarterPlayerScripts > PlayerModule. Copy and paste this module into the same location in Studio, and then close play mode.

Step 2:
Click on the StarterPlayer Folder to bring up its properties, navigate to camera and set DevComputerCameraMode to CameraToggle. This will force players to use the CameraToggle mode in the game. That being said, we’re not quite done yet.
**

**

Step 3:
Open the drop downs for the PlayerModule and CameraModule. Doing this, you should see an army of module scripts that relate to the cameras functionality. However, for this tutorial we only need to modify three of those. That being said, open the following: CameraToggleStateController, CameraInput, and ClassicCamera.

Step 4 (OPTIONAL):
First, we’ll look at CameraToggleStateController. As you may have guessed, this is where a good portion of the magic happens. Unfortunately, though, the only thing we’ll do here is disable the popup GUI and potentially change the cross cursor to whatever you want. To change the cursor, find where it defines CROSS_MOUSE_ICON and simply change the text in quotations to your decal. To disable the popup GUI, search for the following line and disable it with a double dash, or remove it.
CameraUI.setCameraModeToastOpen(doShow)

Step 5:
Inside the CameraInput, search for the area that handles right mouse button up and down events (this begins at line 24 as of the time of writing). In the sections that begin with UserInputService, modify the bindings. Personally, I changed the binding to the KeyCode for LeftControl. Doing this means that the player will now toggle using the LeftControl key rather than the Right Mouse Button. That’s what I call freeing!!

Step 6:
Now that we’ve changed the binding, we can make it so the toggle pan is used by default. To do this, remain in the CameraInput script and navigate down to the section labeled Toggle Pan (Line 441 as of the time of writing). Luckily, you can again ignore 99% of this section. All you need is a single line inside of the CameraInput.enableCameraToggleInput() function. Find the first line in the function that sets togglePan, and change it to true. This will mean that the default camera movement is the toggle mode! Congrats!

Step 7 (OPTIONAL):
Finally, you may want to change the offset of the toggle mode. To do this, navigate to the ClassicCamera script we opened earlier and find the ClassicCamera:GetCameraToggleOffset(dt) function. Here, go down to where the script defines the distanceOffset, and modify the last number on the line (the one being added). By default, this number is 1, but feel free to experiment with this number until you get something you like. If you want the same CameraOffset as the classic camera, change it to -0.190.

With that all considered, you’re done! You’ve successfully forced the ToggleCam and now have the knowledge to customize it to your liking. Happy developing!

23 Likes

How would I change the camera offset on the X axis?

3 Likes

Thanks for this guide!!!

small question: if I change the rmb input to something else. how do i bind any other action to rmb?
shouldn’t we change this on the receiving end? I cant find the receiving end so I might be entirely wrong…

edit: also: i’ve tried it and when i bind it to some other key the toggle no longer works. this is the only thing i’ve found doesnt work in this tutorial

2 Likes

I needed something similar so I’m just adding my required offset to the return line in Step 7:

So adding onto that line would let you offset the camera in whatever direction you need to.

1 Like