Craluminum
Craluminum
CC#
Created by Craluminum on 3/22/2023 in #help
How to write a specific script
I hope I make it as VSCode extension someday
51 replies
CC#
Created by Craluminum on 3/22/2023 in #help
How to write a specific script
Thank you ❤️
51 replies
CC#
Created by Craluminum on 3/22/2023 in #help
How to write a specific script
Yeah it works
51 replies
CC#
Created by Craluminum on 3/22/2023 in #help
How to write a specific script
using System.Text.Json;

namespace CodeFromJson
{
public class Root
{
public Translation translation { get; set; }
public Rotation rotation { get; set; }
public Origin origin { get; set; }
}

public class Origin
{
public float x { get; set; }
public float y { get; set; }
public float z { get; set; }
}

public class Rotation
{
public float x { get; set; }
public float y { get; set; }
public float z { get; set; }
}

public class Translation
{
public float x { get; set; }
public float y { get; set; }
public float z { get; set; }
}

public static class CodeFromJson
{
public static void Main(string[] args)
{
Console.WriteLine("JSON Input:");
string? jsonString = Console.ReadLine();
var tf = JsonSerializer.Deserialize<Root>(jsonString!);

Console.WriteLine($"tf.Translation.X = {tf?.translation?.x}");
Console.WriteLine($"tf.Translation.Y = {tf?.translation?.y}");
Console.WriteLine($"tf.Translation.Z = {tf?.translation?.z}");
Console.WriteLine($"tf.Origin.X = {tf?.origin?.z}");
Console.WriteLine($"tf.Origin.Y = {tf?.origin?.y}");
Console.WriteLine($"tf.Origin.Z = {tf?.origin?.z}");
Console.WriteLine($"tf.Rotation.X = {tf?.rotation.x}");
Console.WriteLine($"tf.Rotation.Y = {tf?.rotation?.y}");
Console.WriteLine($"tf.Rotation.Z = {tf?.rotation?.z}");
}
}
}
using System.Text.Json;

namespace CodeFromJson
{
public class Root
{
public Translation translation { get; set; }
public Rotation rotation { get; set; }
public Origin origin { get; set; }
}

public class Origin
{
public float x { get; set; }
public float y { get; set; }
public float z { get; set; }
}

public class Rotation
{
public float x { get; set; }
public float y { get; set; }
public float z { get; set; }
}

public class Translation
{
public float x { get; set; }
public float y { get; set; }
public float z { get; set; }
}

public static class CodeFromJson
{
public static void Main(string[] args)
{
Console.WriteLine("JSON Input:");
string? jsonString = Console.ReadLine();
var tf = JsonSerializer.Deserialize<Root>(jsonString!);

Console.WriteLine($"tf.Translation.X = {tf?.translation?.x}");
Console.WriteLine($"tf.Translation.Y = {tf?.translation?.y}");
Console.WriteLine($"tf.Translation.Z = {tf?.translation?.z}");
Console.WriteLine($"tf.Origin.X = {tf?.origin?.z}");
Console.WriteLine($"tf.Origin.Y = {tf?.origin?.y}");
Console.WriteLine($"tf.Origin.Z = {tf?.origin?.z}");
Console.WriteLine($"tf.Rotation.X = {tf?.rotation.x}");
Console.WriteLine($"tf.Rotation.Y = {tf?.rotation?.y}");
Console.WriteLine($"tf.Rotation.Z = {tf?.rotation?.z}");
}
}
}
51 replies
CC#
Created by Craluminum on 3/22/2023 in #help
How to write a specific script
It outputs all values as null
51 replies
CC#
Created by Craluminum on 3/22/2023 in #help
How to write a specific script
And still no success
51 replies
CC#
Created by Craluminum on 3/22/2023 in #help
How to write a specific script
I forgot to put null check at translation
51 replies
CC#
Created by Craluminum on 3/22/2023 in #help
How to write a specific script
I input valid json but it gives null for something
51 replies
CC#
Created by Craluminum on 3/22/2023 in #help
How to write a specific script
I only need to output all numbers as float
51 replies
CC#
Created by Craluminum on 3/22/2023 in #help
How to write a specific script
translation, origin and rotation are vectors
51 replies
CC#
Created by Craluminum on 3/22/2023 in #help
How to write a specific script
I need only float for numbers
51 replies
CC#
Created by Craluminum on 3/22/2023 in #help
How to write a specific script
I need to add new()?
51 replies
CC#
Created by Craluminum on 3/22/2023 in #help
How to write a specific script
51 replies
CC#
Created by Craluminum on 3/22/2023 in #help
How to write a specific script
How I can fix it?
51 replies
CC#
Created by Craluminum on 3/22/2023 in #help
How to write a specific script
Why?
51 replies
CC#
Created by Craluminum on 3/22/2023 in #help
How to write a specific script
I input this line
"groundStorageTransform": { "rotation": { "x": 0, "y": 45, "z": 0 }, "origin": { "x": 0.5, "y": 0, "z": 0.5 }, "scale": 0.85 }
"groundStorageTransform": { "rotation": { "x": 0, "y": 45, "z": 0 }, "origin": { "x": 0.5, "y": 0, "z": 0.5 }, "scale": 0.85 }
51 replies
CC#
Created by Craluminum on 3/22/2023 in #help
How to write a specific script
It doesn't work
51 replies
CC#
Created by Craluminum on 3/22/2023 in #help
How to write a specific script
I tried this
using System.Text.Json;

namespace CodeFromJson
{
public class ModelTransform
{
public Vec3f Translation;
public Vec3f Rotation;
public Vec3f Origin;
public float Scale;
}

public class Vec3f
{
public float X;
public float Y;
public float Z;
}

public static class CodeFromJson
{
public static void Main(string[] args)
{
Console.WriteLine("JSON Input:");
string jsonString = Console.ReadLine();
var tf = JsonSerializer.Deserialize<ModelTransform>(jsonString);

Console.WriteLine($"tf.Translation.X = {tf?.Translation.X}");
Console.WriteLine($"tf.Translation.Y = {tf?.Translation.Y}");
Console.WriteLine($"tf.Translation.Z = {tf?.Translation.Z}");
Console.WriteLine($"tf.Origin.X = {tf?.Origin.X}");
Console.WriteLine($"tf.Origin.Y = {tf?.Origin.Y}");
Console.WriteLine($"tf.Origin.Z = {tf?.Origin.Z}");
Console.WriteLine($"tf.Rotation.X = {tf?.Rotation.X}");
Console.WriteLine($"tf.Rotation.Y = {tf?.Rotation.Y}");
Console.WriteLine($"tf.Rotation.Z = {tf?.Rotation.Z}");
Console.WriteLine($"tf.Scale = {tf?.Scale}");
}
}
}
using System.Text.Json;

namespace CodeFromJson
{
public class ModelTransform
{
public Vec3f Translation;
public Vec3f Rotation;
public Vec3f Origin;
public float Scale;
}

public class Vec3f
{
public float X;
public float Y;
public float Z;
}

public static class CodeFromJson
{
public static void Main(string[] args)
{
Console.WriteLine("JSON Input:");
string jsonString = Console.ReadLine();
var tf = JsonSerializer.Deserialize<ModelTransform>(jsonString);

Console.WriteLine($"tf.Translation.X = {tf?.Translation.X}");
Console.WriteLine($"tf.Translation.Y = {tf?.Translation.Y}");
Console.WriteLine($"tf.Translation.Z = {tf?.Translation.Z}");
Console.WriteLine($"tf.Origin.X = {tf?.Origin.X}");
Console.WriteLine($"tf.Origin.Y = {tf?.Origin.Y}");
Console.WriteLine($"tf.Origin.Z = {tf?.Origin.Z}");
Console.WriteLine($"tf.Rotation.X = {tf?.Rotation.X}");
Console.WriteLine($"tf.Rotation.Y = {tf?.Rotation.Y}");
Console.WriteLine($"tf.Rotation.Z = {tf?.Rotation.Z}");
Console.WriteLine($"tf.Scale = {tf?.Scale}");
}
}
}
51 replies
CC#
Created by Craluminum on 3/22/2023 in #help
How to write a specific script
Or from string
51 replies
CC#
Created by Craluminum on 3/22/2023 in #help
How to write a specific script
What class can do that from object?
51 replies