Hey there! I'm trying to create a "translator" for Godot of Unity, the idea is to make more attractive Godot to Unity user (like myself) who want to do some quick testing without having to learn a whole nomenclature, it will also serve me as an excuse to learn more about Godot. So far I've created parts of the Time, Debug and Vector3 classes and one extra class that handles Unity awake, start and gameloop. So far I got this running:
using Godot;
using System;
using Unityfier;
public class KinematicBody : Godot.KinematicBody
{
Godot.Vector3 gVector = new Godot.Vector3(0f, 0f, 0f);
Godot.Vector3 uVector = new Godot.Vector3(0f, 0f, 0f);
Godot.Vector3 target = new Godot.Vector3(10f, 0f, 0f);
//No need to white them all
void Awake()
{
Debug.Log("yawn...");
}
void Start()
{
Debug.Log("Hello world!");
}
void FixedUpdate()
{
Debug.Log("FixedDelta: " + Time.fixedDeltaTime);
}
void Update()
{
Godot.Vector3 test = Unityfier.Vector3.Lerp(uVector, target, Time.deltaTime);
uVector = test;
Debug.Log("Unityfier Lerp: " + uVector);
Debug.Log("Delta: " + Time.deltaTime);
Debug.Log("Frame number: " + Time.frameCount);
}
//This will serve as control but is not really necessary
public override void _Process(float delta)
{
gVector = gVector.LinearInterpolate(target, delta);
Debug.Log("Godot LinearInterpolate: " + gVector);
}
}
This is the output console:
** Debug Process Started **
OpenGL ES 3.0 Renderer: GeForce GTX 750/PCIe/SSE2
yawn...
Hello world!
FixedDelta: 0,01666667
FixedDelta: 0,01666667
FixedDelta: 0,01666667
FixedDelta: 0,01666667
FixedDelta: 0,01666667
FixedDelta: 0,01666667
FixedDelta: 0,01666667
FixedDelta: 0,01666667
Godot LinearInterpolate: (1,333333, 0, 0)
Unityfier Lerp: (1,333333, 0, 0)
Delta: 0,1333333
Frame number: 0
FixedDelta: 0,01666667
FixedDelta: 0,01666667
FixedDelta: 0,01666667
FixedDelta: 0,01666667
FixedDelta: 0,01666667
FixedDelta: 0,01666667
FixedDelta: 0,01666667
FixedDelta: 0,01666667
Godot LinearInterpolate: (2,488889, 0, 0)
Unityfier Lerp: (2,488889, 0, 0)
Delta: 0,1333333
Frame number: 1
FixedDelta: 0,01666667
FixedDelta: 0,01666667
FixedDelta: 0,01666667
FixedDelta: 0,01666667
FixedDelta: 0,01666667
FixedDelta: 0,01666667
FixedDelta: 0,01666667
FixedDelta: 0,01666667
Godot LinearInterpolate: (3,490371, 0, 0)
Unityfier Lerp: (3,490371, 0, 0)
Delta: 0,1333333
Frame number: 2
FixedDelta: 0,01666667 <-- What happened to PhysicsProcess?
Godot LinearInterpolate: (3,668552, 0, 0)
Unityfier Lerp: (3,668552, 0, 0)
Delta: 0,027372
Frame number: 3
FixedDelta: 0,01666667
Godot LinearInterpolate: (3,746442, 0, 0)
Unityfier Lerp: (3,746442, 0, 0)
Delta: 0,012302
Frame number: 4
FixedDelta: 0,01666667
Godot LinearInterpolate: (3,83094, 0, 0)
Unityfier Lerp: (3,83094, 0, 0)
Delta: 0,013512
Frame number: 5
I tried to add a Lerp function to Vector3 but the class it's sealed and I don't really want to change the source code, so... any idea on how I can get rid of having to write the namespace every time y try to use a Vector3? Any ideas or features you might like to add?
Cheers!