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

A Suggestion #3

Open
lucasthomaz97 opened this issue Jan 17, 2025 · 16 comments
Open

A Suggestion #3

lucasthomaz97 opened this issue Jan 17, 2025 · 16 comments
Labels
enhancement New feature or request

Comments

@lucasthomaz97
Copy link

This addon can be pretty useful, there's some stuff missing for me to use in my game:

  • Generate collisions from the meshes
  • Presets like "Cube", "Tube", "Pipe", "Plane", "Half Pipe" for the PathExtrude3D, i kinda made a script for CSGPolygon3D using GDScript, if i felt confident with C++ i could contribute to this.
  • Change the scale in specific points of the Path3D

Take a look on what i have done for the CSGPolygon
BetterCSGPolygonToPath3D.zip

@lucasthomaz97
Copy link
Author

  • I am making an antigravity game, so this addon can be pretty useful to me to make the levels if i have at least a way to generate a collision shape from the PathMesh

@iiMidknightii
Copy link
Owner

I was going to try adding the collision shapes in a future update, but I'll need to study up how Godot makes its collision shapes under the hood. If I get the time I'll definitely try to add it in a future version.

As for presets for the extrude, that's also possible. I'm not sure if it would be better as a separate node or just another set of properties for the presets.

I'm also not sure about how to approach scaling along paths. I could throw in an extra curve property that is sampled from 0 to 1 according to the offset on the Path3D, but that might feel unintuitive. I could also store a scale vector that resizes to match the number of points on the Path3D, but I think you'd lose the fine grain control. Let me know what you think. Right now there's no way to intuitively edit extra data thats stored on the points of the Path3D.

@iiMidknightii iiMidknightii added the enhancement New feature or request label Jan 17, 2025
@lucasthomaz97
Copy link
Author

Thanks for answering so fast.
When you add a mesh instance 3D you can generate a collision body, I think there's a function that does it.
About the scaling I had an idea: an array of classes called Regions, it could use properties called begin / end to determine where in the path will be the influence range, and defining stuff like scale, rotation, offset, and more. It will only influence the range it's defined.

@iiMidknightii
Copy link
Owner

I think that's a pretty good idea. I'll try implementing it to see if it works.

@iiMidknightii
Copy link
Owner

iiMidknightii commented Jan 18, 2025

Hey I implemented the collision shape generation. I haven't updated the releases or the asset library page yet since I'm working on the extrusion presets, but if you download the main branch zip here, it should contain the ability to make collision shapes. You'll have to enable the PathMesh3D plugin in your project settings, as it will add a button to do so just like the button for MeshInstance3D.

@iiMidknightii
Copy link
Owner

I've also added the preset profiles to PathExtrusion3D. Instead of defining a cross section manually, you add a PathExtrusionProfile object. I created two really simple but powerful ones: rectangles and circles. The circle one should cover a lot of those presets as well, such as tubes and half-pipes. The rectangle can be used for boxes and planes. I also made it so you can define your own profile by just creating a script extending PathExtrusionProfileBase and using the _generate_cross_section virtual method.

You can find all this in the v1.1.0 release.

@lucasthomaz97
Copy link
Author

Great! I'll take a look

@lucasthomaz97
Copy link
Author

I tested it here, it's looking pretty good and easy to use!
I just saw some error messages and bugs:

  • The shadows and uv are kinda strange.
  • An error message appears when i click somewhere in the node tree:
    editor/editor_node.cpp:7946 - Condition "plugins_list.has(p_plugin)" is true.
    res://addons/PathMesh3D/plugin.gd:26 - Invalid assignment of property or key 'path_mesh' with value of type 'PathExtrudeProfileCircle' on a base object of type 'MenuButton (path_mesh_3d_options.gd)'.
  • When i change the path3d node the mesh disapears until i click the pathExtrude node again

Image

Image

Image

@iiMidknightii
Copy link
Owner

iiMidknightii commented Jan 20, 2025

  • On your first point, I have noticed some weird behavior with the normals as well, mostly just where the cross section wraps back around to its start. I'll take a look (I think I might have a better way of implementing them). I may also allow the cross section profile class to define its own normals and U values. As for V values, right now they just start at 0.0 at the start of the Path3D and end at 1.0 at its end. I might make some extra properties to "tile" the V values so the texture can tile as well.
  • I'm not sure what's causing that message. The plugin checks that the object is ONLY PathMesh3D or PathExtrude3D, so I don't know why it's trying to assign these other objects. When I click around on different objects and resources, I never get that message to pop up.
  • I just tried a scenario where I changed the path property and it automatically rebuilt. Is it just as simple as changing the path property to a different node or is there something else you are doing that might also trigger it? I have noticed Godot sometimes doesn't register when I rebuild the mesh, and I've actually queued a rebuild twice in a couple places to fix that.

@lucasthomaz97
Copy link
Author

i thinks it stops drawing when i change the in and out of the path.
about the error message, it's happening everywhere in my project..

@iiMidknightii
Copy link
Owner

@lucasthomaz97 does restarting the editor solve any issues? Can you paste a screenshot or a zip file of the plugin.gd file that is generating the error? Maybe it is somehow an older version that had an issue.

@lucasthomaz97
Copy link
Author

I opened godot today and the error just disappeared, it seems like it just needs a restart.

@lucasthomaz97
Copy link
Author

Image
In the circle there's some open side

@iiMidknightii
Copy link
Owner

Ok that's great. I know plugins and gdextension are sometimes a little buggy. When I find some time I'll try to rework the normals and UV mapping. I'll also start experimenting with adding modifiers for scale, rotation, etc.

@iiMidknightii
Copy link
Owner

If you enable smooth, that should mostly go away. I think it's an error with the normal calculations at the seam of the circle. I'll see if I can rework that to make it better.

@iiMidknightii
Copy link
Owner

@lucasthomaz97 I updated the plugin to v1.2, which corrected the generation of normals for PathExtrude3D. If you had created any custom profiles to extrude, you'll have to change the callling signature of _generate_cross_section to return an Array in the same format as an ArrayMesh (just wrap your cross section in an Array for simplest results).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants