in C# the _PhysicsProcess function has delta of type double, however, most Godot parameters work with float and cannot take delta because of this. I know that in System space, there is a function Convert.ToSingle(value), however I get tired of writing it every time and I just don’t like how this function visually clutters up the code. Is there any way to initially get delta as a float?
The other way would be to create a new float variable and assign the doubles value to it.
Or simply write your own conversion function in a singleton script:
public static float ToSingle(double value)
{
return (float)value;
}
I think you misunderstood me a little bit. So far, I’m doing pretty much what is in your code:
float _delta = (float)delta;
However, I would like to change this at the engine level, I tried to change the source code, but it is readonly, so I may have to write a C++ plugin for my idea.
I mention it because it’s the documentation of the error which appears when I attempt to call public override void _Process(double delta) as (float delta).
// CS0115.cs
namespace MyNamespace
{
abstract public class MyClass1
{
public abstract int f();
}
abstract public class MyClass2
{
public override int f() // CS0115
{
return 0;
}
public static void Main()
{
}
}
}
this is not how you make child class MyClass2
should be start likeabstract public class MyClass2: MyClass1
you can do this in parent class
public sealed override void _PhysicsProcess(double delta) => _PhysicsProcess((float)delta);
public virtual void _PhysicsProcess(float delta){}
and now you have only _PhysicsProcess(float delta).