+1 vote

Same as the Title says, I had this problem multiple times and the C# variant is not always just changing the first letter big and remove the underscores.

Is there perhaps a site where i can see all C# variants? The official docs don't seem to have everything.

If possible I would like to know how to do it in C#.

_
_
_
_
_
Code example:


private Spatial fpscamerapivot;
private Spatial thirdcamerapivot;
private bool fps_mode = true;

public override void _Ready()
{ fpscamerapivot = GetNode<Spatial>("FPSCameraPivot"); thirdcamerapivot = GetNode<Spatial>("ThirdCameraPivot"); }



public override void Input(InputEvent inputEvent)
{
if (inputEvent is InputEventMouseMotion eventMouseMotion )
{
if (fps
mode == true)
{
// import event to use it
eventMouseMotion = inputEvent as InputEventMouseMotion; fpscamerapivot.MakeCurrent(); }

Godot version 3.3.2
in Engine by (13 points)
edited by

1 Answer

0 votes

Try in GDscript! Use this example but make any necessary changes...
Example:

func get_input(delta):
 if Input.is_action_just_pressed("youraction")and$yourcamera.current== false:
      $yourcamera2.current = true
 if Input.is_action_just_pressed("youraction")and$yourcamera2.current==false:
      $yourcamera.current = true

This was a simple example on how to change the current Camera by using an action. My example is for two cameras. In case you have more, just repeat the code!

by (86 points)

Thank you very much for the answer!

If possible I would like to know how to do it in C#.

Or can I assume it is not supported for C#?

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.