Using a different Character Controller

Things to remember:

You can use whichever character controller you want

  • You DON'T to use the: New FPS Input script (As you can use a different script unless you want your FPS Controller to inherit from that script)

  • In the GrabSystem script it would be beneficial to use the OnRotateModeChanged event to disable your player

As in my player script I make sure I can disable move and rotate by toggling it on and off when rotating

//My included player controller script

[Header("Control Toggles")]
public bool canMove = true; // Enables/disables player movement
public bool canRotate = true; // Enables/disables camera rotation

private void Update()
{
    // Exit if no input handler is found
    if (inputHandler == null) return;

    // Handle movement, rotation, crouching, and footsteps if enabled
    if (canMove) HandleMovement();
    if (canRotate) HandleRotation();
    HandleCrouching();
    HandleFootsteps();
}

public void SetPlayerDisableMode(bool active)
{
    canMove = !active;
    canRotate = !active;
}

Inside the GrabSystem script you can see the in the RotateObject() method, we so the OnRotateModeChanged with the rotating bool, so therefore it would be wise to do similar for your player script as above

private void RotateObject()
{
    // don’t even start rotation if this object says no
    if (!heldObject.CanRotate) return;

    bool rotating = inputHandler.RotateHeldPressed();

    // fire event when start/stop rotating
    if (rotating != wasRotating)
    {
        onRotateModeChanged?.Invoke(rotating);
        wasRotating = rotating;
    }

Last updated