Open nickpolet opened 2 months ago
Here's a quick and dirty attempt at getting this functionality working to show the proposal functionality better than the description above.
https://github.com/user-attachments/assets/77bf2a92-4381-469b-b7b1-105d2b7478cd
Since this type of functionality is quite important for the game I'm working on, I'd be quite happy to spend some time working on getting this functionality, however, I have a couple of questions.
Any pointers or direction on this would be really helpful. I haven't contributed before, so I'm unsure of the path through :sweat_smile:
- Would the clipping need to be available to all Path, Depth and Spin modes for CSGPolygon?
I think this property only really makes sense for the Path mode, at least for now.
- What would be the best data type for this. In my quick example video above, it's 2 floats, one for start one for end. It might work better acting like the mix/max variables in particle settings.
2 floats is the most logical option. The particle inspector uses a special inspector plugin to allow the inspector to display it in a special manner: https://github.com/godotengine/godot/pull/81260
This would be a lot of work to implement just for CSG, so I'd leave it as-is.
- Is additional CSG functionality like this likely to be accepted and merged if it gets to a useful state?
CSG lacks an active maintainer, so it's hard to say. There's also the fact that CSGPath3D is often being used without actually needing CSG features (union, subtraction, intersection). This has a significant performance overhead as some of this logic runs even if the CSG node has no parent or child CSG nodes.
In other words, what you probably need is a 3D line builder, rather than a CSG node that happens to generate something that can look like a 3D line.
@Calinou, thanks for that. Given me some direction.
CSG lacks an active maintainer, so it's hard to say. There's also the fact that CSGPath3D is often being used without actually needing CSG features (union, subtraction, intersection). This has a significant performance overhead as some of this logic runs even if the CSG node has no parent or child CSG nodes.
In other words, what you probably need is a https://github.com/godotengine/godot-proposals/issues/6151, rather than a CSG node that happens to generate something that can look like a 3D line.
I think I'm willing to try and implement this functionality. I can see the benefit of being able to do this. Unfortunately something like Line3D isn't what I need here, and doesn't help with complex extrusions along a path with complex shapes.
Is there a good discord channel where I can ask implementation specific questions that I might have as I start implementing this?
Is there a good discord channel where I can ask implementation specific questions that I might have as I start implementing this?
Engine development is coordinated on the Godot Contributors Chat :slightly_smiling_face:
Describe the project you are working on
Working on a racing game that requires some fairly complex meshes to be extruded along curves (for racetracks), Currently, CSGPolygon meshes can be generated along a curve nicely, but the only option is to extrude along the whole curve.
Describe the problem or limitation you are having in your project
Being able to have different CSGPolygon meshes that can have different start and end points along the curve would allow for much greater flexibility.
Describe the feature / enhancement and how it helps to overcome the problem or limitation
Adding
clip_start
andclip_end
or something similar to CSGPolygon would allow the generated mesh to start and end at custom points along the mesh. Ideally, the interval length should be respected and the mesh should start from the clip_start and end at clip_end.Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams
The basic idea is to add clip_start and clip_end to CSGPolygon, which affects the mesh similar to the below mockup.
These are just rough values to help show the idea. The Curve3D is represented by the green line here.
If this enhancement will not be used often, can it be worked around with a few lines of script?
I don't think this is possible with just a few lines.
Is there a reason why this should be core and not an add-on in the asset library?
After having a look through the _build_brush function for CSGPolygon, the initial sample point for the curve is hardcoded to 0. There would also need to be quite a few adjustments to other variables/logic in that function. I don't think any of this is exposed to gdscript to make adjustments there.