Forum rules - please read before posting.

Camera Follow Cursor Global Toggle?

Hey everyone,

I released my game, Dexter Stardust: Adventures in Outer Space, a little over a month ago and things have been going well. Check it out here:

https://tinyurl.com/573m2892

However, I received an email from one player that said that "Follow Cursor" on the Game Camera (2d Script) causes him to have motion sickness (he did say that he's very sensitive to motion sickness). This is something I hadn't considered.

**My question is: **is there a way to have a global variable (not necessarily "Global Variable" in the AC sense, but more in the C# sense) to toggle Follow Camera ON/OFF? If not, can this be a feature request?

I look forward to any help. Thanks!

Comments

  • You'll need to use a C# script to update the camera setting (followCursor), but you can still rely on an AC Global Variable to record its intended state. This variable can be linked to Options Data to have it be part of the Options menu, and independent from save-game files.

    The following code will update all cameras according to a Global Boolean variable named "FollowCursor":

    bool doFollowCursor = GlobalVariables.GetVariable ("FollowCursor").BooleanValue;
    CursorInfluenceCamera[] cursorInfluenceCameras = FindObjectsOfType<CursorInfluenceCamera> ();
    foreach (CursorInfluenceCamera cursorInfluenceCamera in cursorInfluenceCameras)
    {
        cursorInfluenceCamera.followCursor = doFollowCursor;
    }
    
  • Thank you so much, Chris!

    1. I copied and pasted that code exactly how it is written above on line 39 in the CursorInfluenceCamera.cs script.
    2. I created a Global Variable called "FollowCursor".
    3. In my options menu, I created a Toggle (copied and pasted the Subtitles toggle).
    4. I set the Toggle Type to "Variable", and the Global Boolean variable to the "Follow Cursor variable.

    Works perfectly! Really lovely stuff. Much appreciated!

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.