CharacterBody2D.MotionModeEnum in C#

Godot Version

Godot.Net v4.2.1


I am trying to instance a CharacterBody2D node in a C# script. I would like to set the MotionMode of the node to Floating, but I can’t seem to find much information about how to do this in C#?

You first check documentation. even is GDScript Class, C# is close enough.
rest is to know how use C# like enums

MotionMode = MotionModeEnum.Floating;

So if I had a node characterBody2DNode, what would be the explicit line of code in C# that would set its MotionMode to Floating?

using Godot;
public partial class MyScriptNode : CharacterBody2D
	public override void _Ready()
          MotionMode = MotionModeEnum.Floating;

if you referring other node in your script

var otherNode = GetNode<CharacterBody2D>("NodePath");
otherNode.MotionMode = MotionModeEnum.Floating;
1 Like

Thank you!