Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Geometry.CreateSphere() should get its own class? #11

Open
valkyrienyanko opened this issue Dec 4, 2022 · 0 comments
Open

Geometry.CreateSphere() should get its own class? #11

valkyrienyanko opened this issue Dec 4, 2022 · 0 comments
Labels
help wanted Extra attention is needed question Further information is requested

Comments

@valkyrienyanko
Copy link
Contributor

I was thinking of doing something like

var sphere = Sphere.Create(); // or could be cube
sphere.SetColor(Colors.Blue).SetSize(0.5f).DeleteLater(2);

public static void CreateSphere(Vector3 pos, float radius = 0.2f, float removeDelay = -1)
{
var sphere = new MeshInstance3D();
sphere.Mesh = new SphereMesh();
var sphereMesh = (SphereMesh)sphere.Mesh;
sphereMesh.Radius = radius;
sphereMesh.Height = sphereMesh.Radius * 2;
sphere.Position = pos;
if (removeDelay != -1)
{
var timer = SceneTree.CreateTimer(removeDelay);
timer.Timeout += () => sphere.QueueFree();
}
SceneTree.Root.AddChild(sphere);
}

@valkyrienyanko valkyrienyanko added the help wanted Extra attention is needed label Dec 4, 2022
@valkyrienyanko valkyrienyanko changed the title Geometry.CreateSphere() should get its own class? Geometry.CreateSphere() should get its own class? Dec 4, 2022
@valkyrienyanko valkyrienyanko added the question Further information is requested label Dec 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed question Further information is requested
Projects
None yet
Development

No branches or pull requests

1 participant