HAPTIC FISHING / STUDY / LEVEL 3 OF 7
Casting: from hand
speed to a parabola.
In the headset you just throw your hand forward. The game has to answer three questions: was that a cast? Where does the bobber go, and how fast? Where does it land, and is that inside the pond? The answers are all in one short file, castPhysics.js. The game and this page use the same copy.
Top view: the mouse is your hand
press the green dot, flick it up toward the pond, releaseTo make it workable on a screen, 4 cm of mouse movement counts as 1 cm of hand movement. The bobber leaves from the rod tip, about 1.3 m in front of and above the hand.
Numbers right now
ready to cast- hand speed |v|
- 0.00
- idle for (idleFor)
- 0.0 s
- launch speed
- –
- time in the air
- –
- landing distance from centre
- –
- result
- –
The side view adds a dashed arc: the same launch speed at the angle you choose, flown with the same flightStep. The game always uses 34° (CAST_ANGLE = 0.6 radians).
Side view: height and distance
each dot is the bobber's position in one frame (1/72 s)The code in use
castPhysics.jsThe file is only a few small functions. As you drag, cast, fly and land, the highlight jumps to the one in use.
throwCast and flightStep)Three things you should be able to explain
- Velocity = distance ÷ time. The game does not know you "threw". It only knows where the hand is each frame. Subtract the last position and divide by
dt: that is the velocity. To ignore hand jitter, the new value counts for only 40% (cg.mix(old, new, .4)), a simple form of smoothing. - Only the part toward the pond counts.
forwardSpeeduses the dot product (dot) to project the velocity onto the direction of the pond. Pulling back or swinging sideways does not count; only throwing toward the pond does. - The parabola is not drawn. Each frame the bobber does two things: its vertical velocity loses
9.8 × dt(gravity), and its position moves byvelocity × dt. Repeat that frame after frame and a parabola appears. This is the same "rate × dt" idea as Level 2, called numerical integration.
Exercises: ① Drag the dot up slowly. The speed toward the pond never crosses the line, so nothing is cast. ② Flick hard toward the upper left. Where does the bobber go, and does it land in the pond? ③ After a cast, set the comparison angle to 20°, 34° and 45° and compare where the dashed arc lands. You may have learned that "45° throws farthest". Why is 45° not the farthest here? Hint: the bobber leaves a rod tip 1.9 m high and lands on much lower water.