Simplify the edge wrap: 8 state variables instead of 15 #9
Loading…
Reference in a new issue
No description provided.
Delete branch "simpler-wrap"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What this does
Cuts the edge wrap's state from 15 variables to 8 by only storing what can't be worked out from the rest.
Stored now:
isWrapping,wrapCorner,wrapFromNormal(the surface we're leaving),wrapOntoNormal(the surface we land on),wrapEntryStart,wrapArcStartAngle,wrapSpeed,wrapDistanceTravelled.Worked out by small helpers instead:
wrapFromDistance,wrapToDistance_wrap_radius()wrapArcLength_wrap_arc_length()(angle × radius)wrapEntryLength_wrap_entry_length()wrapExitOffset_wrap_exit_offset()(back along the surface we left)wrapFromRotation,wrapToRotation_rotation_for(normal)wrapFromAngle,wrapToAnglewrapArcStartAnglecovers where the arc begins)_begin_wrapnow takes(corner, fromNormal, ontoNormal[, arcStartAngle])instead of five loosely related values, and_finish_wrapno longer needs an if/else for the exit direction.wrapArcStartAnglestays because the wall-top wrap starts part way around the corner (we've already climbed past it), so its arc start can't be worked out from the surface.Behaviour
Testing
test_level.tscnloads and runs.🤖 Generated with Claude Code