zeroed-some/dougk / 3d099f7

Browse files

reduce donny angle, re-attempt koi trajectories

Authored by espadonne
SHA
3d099f7eaf85298d154a9b861f21b69565245a4e
Parents
978c402
Tree
bbf6b4a

2 changed files

StatusFile+-
M src/renderers/three/koi.js 5 5
M src/renderers/three/narwhal.js 9 9
src/renderers/three/koi.jsmodified
@@ -222,8 +222,8 @@ export function createKoiSchool(scene, gradientMap, pondRadius) {
222
       const dz = s.targetZ - koi.group.position.z
222
       const dz = s.targetZ - koi.group.position.z
223
       const dist = Math.hypot(dx, dz)
223
       const dist = Math.hypot(dx, dz)
224
 
224
 
225
-      // Always swim forward, turn gradually
225
+      // Calculate target rotation - koi model faces +X, so use atan2(dz, dx)
226
-      const targetRot = Math.atan2(dx, dz)
226
+      const targetRot = Math.atan2(dz, dx)
227
 
227
 
228
       // Very smooth rotation - fish don't turn sharply
228
       // Very smooth rotation - fish don't turn sharply
229
       let rotDiff = targetRot - koi.group.rotation.y
229
       let rotDiff = targetRot - koi.group.rotation.y
@@ -234,10 +234,10 @@ export function createKoiSchool(scene, gradientMap, pondRadius) {
234
       const turnRate = s.panicMode ? 2.5 : 1.2
234
       const turnRate = s.panicMode ? 2.5 : 1.2
235
       koi.group.rotation.y += rotDiff * turnRate * delta
235
       koi.group.rotation.y += rotDiff * turnRate * delta
236
 
236
 
237
-      // Always moving forward (fish don't stop mid-water)
237
+      // Move in the direction koi is facing (model faces +X, so use cos/sin)
238
       const moveSpeed = s.panicMode ? s.speed * 1.8 : s.speed * 0.5
238
       const moveSpeed = s.panicMode ? s.speed * 1.8 : s.speed * 0.5
239
-      const moveX = Math.sin(koi.group.rotation.y) * moveSpeed * delta
239
+      const moveX = Math.cos(koi.group.rotation.y) * moveSpeed * delta
240
-      const moveZ = Math.cos(koi.group.rotation.y) * moveSpeed * delta
240
+      const moveZ = Math.sin(koi.group.rotation.y) * moveSpeed * delta
241
       koi.group.position.x += moveX
241
       koi.group.position.x += moveX
242
       koi.group.position.z += moveZ
242
       koi.group.position.z += moveZ
243
 
243
 
src/renderers/three/narwhal.jsmodified
@@ -238,13 +238,13 @@ export function createDonny(scene, gradientMap) {
238
         // Rise from the water
238
         // Rise from the water
239
         const emergeProgress = Math.min(state.timer / 1.5, 1)
239
         const emergeProgress = Math.min(state.timer / 1.5, 1)
240
         const easeOut = 1 - Math.pow(1 - emergeProgress, 3)
240
         const easeOut = 1 - Math.pow(1 - emergeProgress, 3)
241
-        group.position.y = -2 + easeOut * 2.5 // Rise higher out of water
241
+        group.position.y = -2 + easeOut * 2.25 // Rise higher out of water (10% less)
242
 
242
 
243
         // Slowly turn toward Doug - lugubrious, not laser tracking
243
         // Slowly turn toward Doug - lugubrious, not laser tracking
244
         group.rotation.y = lerpAngle(group.rotation.y, angleToDoug, delta * 0.5)
244
         group.rotation.y = lerpAngle(group.rotation.y, angleToDoug, delta * 0.5)
245
 
245
 
246
-        // Tilt nose UP ~55 degrees - rotate around Z since model faces +X
246
+        // Tilt nose UP ~50 degrees - rotate around Z since model faces +X (8% less)
247
-        group.rotation.z = 0.95 * easeOut
247
+        group.rotation.z = 0.87 * easeOut
248
 
248
 
249
         // Gentle side-to-side rocking
249
         // Gentle side-to-side rocking
250
         group.rotation.x = Math.sin(state.timer * 4) * 0.06
250
         group.rotation.x = Math.sin(state.timer * 4) * 0.06
@@ -257,14 +257,14 @@ export function createDonny(scene, gradientMap) {
257
         break
257
         break
258
 
258
 
259
       case 'surfaced':
259
       case 'surfaced':
260
-        // Bob gently, positioned higher
260
+        // Bob gently, positioned at adjusted height
261
-        group.position.y = 0.5 + Math.sin(elapsed * 2) * 0.06
261
+        group.position.y = 0.25 + Math.sin(elapsed * 2) * 0.06
262
 
262
 
263
         // Slowly turn toward Doug
263
         // Slowly turn toward Doug
264
         group.rotation.y = lerpAngle(group.rotation.y, angleToDoug, delta * 0.3)
264
         group.rotation.y = lerpAngle(group.rotation.y, angleToDoug, delta * 0.3)
265
 
265
 
266
-        // Keep steep tilt ~55 degrees - nose up, tail in water
266
+        // Keep tilt ~50 degrees - nose up, tail in water
267
-        group.rotation.z = 0.95 + Math.sin(elapsed * 1.5) * 0.04
267
+        group.rotation.z = 0.87 + Math.sin(elapsed * 1.5) * 0.04
268
 
268
 
269
         // Gentle side-to-side rocking
269
         // Gentle side-to-side rocking
270
         group.rotation.x = Math.sin(elapsed * 1.5) * 0.03
270
         group.rotation.x = Math.sin(elapsed * 1.5) * 0.03
@@ -291,10 +291,10 @@ export function createDonny(scene, gradientMap) {
291
         // Sink back down
291
         // Sink back down
292
         const submergeProgress = Math.min(state.timer / 1.2, 1)
292
         const submergeProgress = Math.min(state.timer / 1.2, 1)
293
         const easeIn = Math.pow(submergeProgress, 2)
293
         const easeIn = Math.pow(submergeProgress, 2)
294
-        group.position.y = 0.5 - easeIn * 2.7
294
+        group.position.y = 0.25 - easeIn * 2.5
295
 
295
 
296
         // Tilt nose down as diving back under
296
         // Tilt nose down as diving back under
297
-        group.rotation.z = 0.95 - easeIn * 1.2
297
+        group.rotation.z = 0.87 - easeIn * 1.1
298
 
298
 
299
         // Add bubbles/ripples as submerging
299
         // Add bubbles/ripples as submerging
300
         if (Math.random() < delta * 4) {
300
         if (Math.random() < delta * 4) {