It took time to get the code working correctly. This is rope mesh generator and spring mechanic.
create MeshIstance3D
- mesh > new ImmediateMesh
#links:
| // raylib 5.5 | |
| // flecs v4.1.1 | |
| // strange rotation for gui | |
| // y -85 to 85 is cap else it will have strange rotate. | |
| // note that child does not update the changes. | |
| #include <stdio.h> | |
| #include "raylib.h" | |
| #include "raymath.h" | |
| #include "flecs.h" | |
| #define RAYGUI_IMPLEMENTATION |
| // flecs v4.1.1 | |
| // strange rotation for gui | |
| // y -85 to 85 is cap else it will have strange rotate. | |
| #include <stdio.h> | |
| #include "raylib.h" | |
| #include "raymath.h" | |
| #include "flecs.h" | |
| #define RAYGUI_IMPLEMENTATION | |
| #include "raygui.h" |
| // raylib 5.5 | |
| // flecs v4.1 | |
| // https://github.com/SanderMertens/flecs/blob/master/examples/c/systems/custom_pipeline/src/main.c | |
| // | |
| #include <stdio.h> | |
| #include <flecs.h> | |
| #include "raylib.h" | |
| #include <math.h> | |
| #define RAYGUI_IMPLEMENTATION | |
| #include "raygui.h" |
| // raylib | |
| // https://github.com/SanderMertens/flecs/blob/master/examples/c/systems/custom_pipeline/src/main.c | |
| #include <stdio.h> | |
| #include <flecs.h> | |
| #include "raylib.h" | |
| //#define RAYGUI_IMPLEMENTATION | |
| //#include "raygui.h" | |
| // component |
| @tool | |
| extends MeshInstance3D | |
| @export var rope_length: float = 5.0 # Total length of the rope | |
| @export var segments: int = 20 # Number of segments | |
| @export var radius: float = 0.1 # Thickness of the rope | |
| @export var sides: int = 8 # Number of sides for the rope's cross-section | |
| func _ready() -> void: | |
| generate_rope() |
| @tool | |
| extends MeshInstance3D | |
| # this is for ImmediateMesh | |
| # works uv align but scale does not work. | |
| # Rope properties | |
| @export var rope_width: float = 0.1 # Radius of the rope | |
| @export var resoulution: int = 8 # Number of vertices around the rope's circumference | |
| @export var uv_scale: Vector2 = Vector2(1.0, 1.0) # UV scaling factor | |
| @export var texture_height_to_width: float = 1.0 # Texture aspect ratio (height/width) |
It took time to get the code working correctly. This is rope mesh generator and spring mechanic.
create MeshIstance3D
- mesh > new ImmediateMesh
#links:
| bl_info = { | |
| "name": "Test Build", | |
| "category": "3D View", | |
| "author": "lightnet", | |
| "blender": (4, 4, 0), | |
| "version": (0, 0, 1), | |
| "description": "Test Script", | |
| "doc_url": "", | |
| "tracker_url": "", | |
| } |
Blender 4.4.x
Testing how node editor works. Trying to make simple as possible but the register and unregister has some bug to handle remove nodes.