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

Added a center_offset property to both plane primitive and quad primitive #48764

Merged
merged 1 commit into from
Jul 11, 2021

Conversation

QbieShay
Copy link
Contributor

@QbieShay QbieShay commented May 16, 2021

Adds offset to plane and quad meshes, useful for VFX.

Bugsquad edit: 3.x version: #48763

@Calinou
Copy link
Member

Calinou commented May 16, 2021

Out of curiosity, why not move the plane/quad mesh itself? Or is this for use in particles?

@QbieShay
Copy link
Contributor Author

@Calinou particles exactly :)
simplest example that comes to mind is if you want to have some rays coming out in all directions. Right now you need to make your own custom mesh with a pivot at the bottom of the quad, but with this addition you don't need a custom mesh.

@Calinou
Copy link
Member

Calinou commented May 16, 2021

I wonder if this property should be added to all primitive meshes, or just QuadMesh and PlaneMesh. There's a PrimitiveMesh base class after all.

@QbieShay
Copy link
Contributor Author

I have thought about it, but i wasn't sure of the usecase for other meshes. It shouldn't be a problem to add it later, if the name is kept, right?

@Calinou
Copy link
Member

Calinou commented May 16, 2021

I have thought about it, but i wasn't sure of the usecase for other meshes. It shouldn't be a problem to add it later, if the name is kept, right?

I think it's OK to make a property more general in future 3.x releases, but I'm not sure. It might break the GDNative API at least.

Copy link
Member

@Calinou Calinou left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Feature looks good to me.

@@ -211,6 +211,7 @@ class PlaneMesh : public PrimitiveMesh {
Size2 size = Size2(2.0, 2.0);
int subdivide_w = 0;
int subdivide_d = 0;
Vector3 center_offset = Vector3(0.0, 0.0, 0.0);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

0, 0, 0 is the default value for Vector3, so you don't need to assign anything.

scene/resources/primitive_meshes.cpp Show resolved Hide resolved
@@ -258,7 +258,7 @@ PrimitiveMesh::~PrimitiveMesh() {
}

/**
CapsuleMesh
CapsuleMesh
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If changing this, would be good to make it match others (2 spaces).

@@ -274,6 +278,7 @@ class QuadMesh : public PrimitiveMesh {

private:
Size2 size = Size2(1.0, 1.0);
Vector3 center_offset = Vector3(0.0, 0.0, 0.0);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here.

@akien-mga akien-mga merged commit fb3961b into godotengine:master Jul 11, 2021
@akien-mga
Copy link
Member

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants