Forum rules - please read before posting.

Player view in point and click mode

My project is currently a third person point and click game with a stationary camera (most of the time). I'm trying to come up with a method to allow the player to click a "look" button and have the camera move to the player's first person view but not allow the player to move.

I've tried using a first person camera inside the player prefab's head and using the Engine: Manage Systems action to change the movement method to first person before switching cameras, but the camera does not move with the cursor unless the player presses "alt" (which is the toggle cursor button). 

I'm trying to make this project as user friendly as possible, and playable completely with just the mouse, so I want to figure out a way to "toggle" the cursor in an action list, but so far I'm not finding anything. I suppose an Input: Simulate Input action would work well here. Is that doable?

Also if I'm going about this the wrong way and there's another way to change from a stationary third person camera view to a first person free-look view I'd love to hear it. I've played around with the "follow cursor" settings on the normal gamecamera script but that doesn't give me full 360 degree rotation.


  • Yes, simulating the input sounds like the best way.  I would strongly recommend detaching it from the "alt" key though, so that only you have control over when ToggleCursor is called.

    If you wanted to make use of your own camera script, then just attach the _Camera component to it and AC will be able to use it in Actions.  Then, attach the ConstantID component, and check Retain in prefab.  That way, you can refer to it in an ActionList asset by this number, so that it will be available no matter what scene you're in.
  • For someone who is not great at scripting, I assume the best way to set up the Input: Simulate Input custom action would be to take the relevant "simulate input" chunks of the menu script and put them into a custom action template? 

    Or perhaps an easier way would be to use the Input: Check script and just substitute most of the "checking" code with the "simulating" code from the menu script?

    Also if it's simple enough, maybe this is an action you can add to the next update? It seems like it would be pretty useful to have. Thanks, as always!

  • edited March 2015
    So this is my horrible chop and swap attempt at an Input: Simulate Input action- note that the GUI portion works well enough so I haven't included that code. The function of simulating an input however does not work. Am I close at all or is it way off? 

    Edit: Nevermind, got it to work! Hooray, my first custom action! Thanks!

    It's definitely not perfect though- as it is now, you need to specify both an axis and a button name, and it can't work with parameters. Here's the script if anyone wants to help refine it- 

    (See next comment, script goes over the character limit)
  • edited March 2015
    Edit: Not sure what I did to it, but now it's not working again. 

    namespace AC
    public class ActionSimulateInput : Action
    public SimulateInputType simulateInput = SimulateInputType.Button;
    public float simulateValue = 1f;
    public string inputName;
    public int parameterID = -1;
    public string inputAxis;
    public InputCheckType checkType = InputCheckType.Button;
    public IntCondition axisCondition;
    public float axisValue;
    public ActionSimulateInput ()
    this.isDisplayed = true;
    title = "Input: Simulate";
    override public void AssignValues (List<ActionParameter> parameters)
    inputName = AssignString (parameters, parameterID, inputName);
    public void Declare ()
    simulateInput = SimulateInputType.Button;
    simulateValue = 1f;
    inputAxis = "";
    override public float Run ()
    if (inputName != "")
    KickStarter.playerInput.SimulateInput (simulateInput, inputAxis, simulateValue);
    if (!isRunning)
    isRunning = true;
    return defaultPauseTime;
    isRunning = false;
    return 0f;
    override public void ShowGUI (List<ActionParameter> parameters)
    simulateInput = (SimulateInputType) EditorGUILayout.EnumPopup ("Simulate:", simulateInput);
    inputAxis = EditorGUILayout.TextField ("Input axis:", inputAxis);
    if (simulateInput == SimulateInputType.Axis)
    simulateValue = EditorGUILayout.FloatField ("Input value:", simulateValue);
    //parameterID = Action.ChooseParameterGUI (SimulateInputType.ToString () + " name:", parameters, parameterID, ParameterType.String);
    //if (parameterID < 0)
    // inputName = EditorGUILayout.TextField (SimulateInputType.ToString () + " name:", inputName);
    AfterRunningOption ();
    public override string SetLabel ()
    return (" (" + inputName + ")");
  • So can someone give me a few tips to finish this script? I still feel like an Input: Simulate Input action would be quite useful for a lot of people.
  • If you're commenting out the setting of parameterID in ShowGUI, then you should also comment out the line in AssignValues.

    You also don't need to have any of the "isRunning" code in Run, since that's only for Actions that run over time.  Just "return 0f" after calling SimulateInput.
  • Excellent, thanks. I got it to work, though it's still a bit messy overall- the Simulate drop down still has the "button" and "axis" options, but the script only works when the "button" option is chosen, even though you must still define the axis in the Input Axis field.

    So it might be a bit to messy to share officially but it suits my needs at least. Thanks again!
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.