Closed fire closed 2 months ago
Yeah, please do.
I see if I can find some effort when I get stuck on my gltf2 task to do the port to godot engine master. It'll be a non-core c++ module and be less accessible but still workable.
I have been meaning to contribute to godot for a while now. I can try porting it to master. For the dependencies, what are the new ways to draw immediate geometry in godot4? I dont see an ImmediateGeometry node in godot4. The VisualServer should probably used anyway since it doesnt have the overhead of immediate geometry. How do you think this should be implemented?
Godot 4 uses ImmediateMesh. I'll research your other questions.
https://github.com/V-Sekai/godot-verlet-rope is my branch.
I'm having some trouble it. Can you review? Then I can port to C++.
The mesh looks very thin.
https://user-images.githubusercontent.com/32321/146685438-1e8f1336-6b51-451e-a639-ba124fe152d7.mp4
Here's a non godot example:
https://twitter.com/R_Nikaido/status/1274142361635876866?s=20
Do you think the bug is that you need to go from vector3 to Transform3D?
That is a known problem. In editor mode there is no way to get the position of the editor camera, and so the rope cannot always "billboard" in the direction of the camera. But in play mode it looks correct. If godot 4 has a way to get the position of the editor camera a bit of code should be able to fix it. The last of us rope physics is very impressive. collisions with the environment looks great. but doesn't collide with itself though.
if godot 4 returns the editor camera when calling get_viewport().get_camera_3d()
then it should work in editor too.
I wasn't able to get this to work.
func _calculate_rope_orientation_with_camera() -> void:
var camera: Camera3D = get_viewport().get_camera_3d()
if Engine.is_editor_hint():
camera = EditorInterface.new().get_edited_scene_root().get_parent()
In terms of what can be improved in my current implementation, here are some things.
Will evaluate the list.
Here's the video of the current results.
https://user-images.githubusercontent.com/32321/146817364-c1592a36-f516-4760-bbf1-f4334cffd179.mp4
Edited:
Twisting problems.
Being able to select and move the start/end points directly from the editor viewport. Currently you need to navigate through the scene tree and find the one you're looking for. Maybe a system like the bezier curves would be nicer?
This is entirely doable. We added a gizmos (plural) system for skeleton transforms on a single node, it should work here too.
Ye the twisting problem really isnt solvable if its being rendered with quads. at some point one quad is going to get pinched. Ropes with volume would solve it but was a little heavy for gdscript to handle.
edit: half life 2 did not have textured ropes (unshaded black), so the pinch wasnt noticable.
Want to break this apart into the Godot Engine proposal format?
Being able to select and move the start/end points directly from the editor viewport. Currently you need to navigate through the scene tree and find the one you're looking for. Maybe a system like the bezier curves would be nicer?
Adding forces to a particle or group of particles from script. Imagine explosions affecting the rope.
Get normal mapping working, it would give some depth to the rope.
Better collisions
If performance allows, having a rope with volume would be nice. 4-16 vertices with smooth shading.
Do you want me to port to c++? Are you ok with requiring the dependency. It's unclear if Godot Engine 4 will accept this but I can make the port.
I did a bit of testing if my current implementation can be used with rigidbodies and pin joints, and it doesnt look too bad.
Are you ok with requiring the dependency
dependency on what?
By a port to c++ you mean as a module or into godot4? I would prefer if we can get this into godot4.
A 2d version of this would also be a nice addition.
@2nafish117 Can you write a proposal or point to an existing proposal on godot-proposals?
https://github.com/godotengine/godot-proposals/issues
My gut feeling is we need to poll the community to see their thoughts. Not sure.
ive created a propsal. https://github.com/godotengine/godot-proposals/issues/3704 From reading the main readme i get the feeling this fits more into a module rather than core.
Would you be interested in a c++ module for this?
I could try porting it.