diff --git a/nodes/max/plantarium/branch/src/input.json b/nodes/max/plantarium/branch/src/input.json index 5136079..c116beb 100644 --- a/nodes/max/plantarium/branch/src/input.json +++ b/nodes/max/plantarium/branch/src/input.json @@ -83,6 +83,14 @@ "min": 0, "max": 360, "step": 0.01, + "value": 137.5 + }, + "angle": { + "type": "float", + "description": "Upward tilt of branches. 0 = horizontal, positive = upward, negative = drooping.", + "min": -90, + "max": 90, + "step": 1, "value": 0 } } diff --git a/nodes/max/plantarium/branch/src/lib.rs b/nodes/max/plantarium/branch/src/lib.rs index 6f9b60d..7a4a7d5 100644 --- a/nodes/max/plantarium/branch/src/lib.rs +++ b/nodes/max/plantarium/branch/src/lib.rs @@ -78,7 +78,9 @@ pub fn execute(input: &[i32]) -> Vec { continue; } - let branch_direction = rotate_vector_by_angle(orthogonal, direction, rotation_angle); + let up_angle = evaluate_float(args[10]) * PI / 180.0; + let tilted = (orthogonal * up_angle.cos() + direction * up_angle.sin()).normalize(); + let branch_direction = rotate_vector_by_angle(tilted, direction, rotation_angle); log!( "BRANCH depth: {}, branch_origin: {:?}, direction_at: {:?}, branch_direction: {:?}",