Forum rules - please read before posting.

Lock MouseLook Ability in UFPS During Cutscenes

I wrote this really quick action that allows for you to stop the camera from following the cursor when the camera switches. I found that when I cut to a different camera, my UFPS camera was still following the mouse regardless.

using UnityEngine;
using System.Collections;
#if UNITY_EDITOR
using UnityEditor;
namespace AC
{
[System.Serializable]
public class ActionMouseLook : Action
{
public bool newMouseLookState;
public Char charToMove;

public ActionMouseLook ()
{
this.isDisplayed = true;
title = "Player: Lock MouseLook";
}
override public float Run ()
{
charToMove = KickStarter.player;
charToMove.GetComponent<vp_FPInput> ().MouseCursorBlocksMouseLook = newMouseLookState;
return 0f;
}
#if UNITY_EDITOR
override public void ShowGUI ()
{
newMouseLookState = EditorGUILayout.Toggle ("Lock MouseLook:", newMouseLookState);
AfterRunningOption ();
}
}
}

When you start a cutscene, just set the Lock MouseLook to true, and when the player regains control, set it to false! I hope it can help someone.

All the best,
Josh
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.