Devlog #9π
Prepare
- π© Learn godot
Create basic line addition
- π© Static line on mouse enter/exit
Filter valid lines
- π© only cross two sides
- π© mouse clicking (cut mode on)
- π© mouse velocity high enough
- π₯ Stops counting after 0.2 seconds
Shape as polygon
- π₯ Rename rect / _get_rect_local() -> polygon equivalents (correct calc)
- π₯ Rename rect_edges / _get_rect_edges() -> polygon edge list (correct calc)
- π₯ Store shape as a point list
- π₯ Render shape from that point list (Polygon2D)
- π₯ Match collider to the same points (CollisionPolygon2D)
- π₯ _is_inside` uses Geometry2D.is_point_in_polygon
- π₯ Enter/exit hits use polygon edges (not just 4 rect sides)
Perform a real cut
- π₯ On valid swipe, get enter + exit points on the polygon
- π₯ Split the point list into two polygons along that cut
- π₯ Replace the old shape with the two new shapes (visual + collider)
- π₯ Remove / ignore the cut line after the split (or keep as VFX only)
Cut pieces move
- π₯ Put each piece on its own body (RigidBody2D or AnimatableBody2D / manual motion)
- π₯ On split, give each piece a velocity away from the cut (impulse / linear_velocity)
- π₯ Optional: add gravity / spin so pieces fall and rotate
- π₯ Optional: despawn pieces after a short time or off-screen
Stop here (matches βuntil pieces moveβ) π
- π₯ One shape -> swipe -> two pieces fly apart
(i used ai to make this devlog but it just turned my attachment into markdown, thatβs all)
Comments 0
No comments yet. Be the first!
Sign in to join the conversation.