Expanding

How do I use a different character controller with this system?

In the β€œDisableManager” script we reference the player controller so we can disable the β€œFirstPersonController” script.
When we interact with the object we disable character movement and camera rotation. If you’re using a different controller please replace that reference with the way to disable your controllers movement and camera rotation!
My example scene has a variable called "FIrstPersonController player = null" - This is reference the "FirstPersonController" script and we give it the name of "player".
You can change "FirstPersonController" to your controller and how you would like to disable the camera movement and player movement.
1
public class ExamineDisableManager : MonoBehaviour
2
{
3
public static ExamineDisableManager instance;
4
​
5
[SerializeField] private Image crosshair = null;
6
[SerializeField] private FirstPersonController player = null;
7
[SerializeField] private ExamineRaycast raycastManager = null;
8
[SerializeField] private BlurOptimized blur = null;
Copied!
In the snippet below, we can disable the player and camera movement by setting "player.enabled = false" because this will disable the "FirstPersonController" script which controls both the player movement AND camera movement. This is where you would change those two statements accordingly!
If you have any issues at all, do send me an email! :)
1
public void DisablePlayer(bool disable)
2
{
3
if (disable)
4
{
5
raycastManager.enabled = false;
6
Cursor.lockState = CursorLockMode.None;
7
Cursor.visible = true;
8
blur.enabled = true;
9
crosshair.enabled = false;
10
player.enabled = false;
11
}
12
else
13
{
14
raycastManager.enabled = true;
15
Cursor.lockState = CursorLockMode.Locked;
16
Cursor.visible = false;
17
blur.enabled = false;
18
crosshair.enabled = true;
19
player.enabled = true;
20
}
Copied!
Last modified 1yr ago
Copy link