]> git.seodisparate.com - jumpartifact.com_demo_0/commitdiff
Refactor y-pos calc. on Walker move (again)
authorStephen Seo <seo.disparate@gmail.com>
Fri, 11 Aug 2023 04:42:20 +0000 (13:42 +0900)
committerStephen Seo <seo.disparate@gmail.com>
Fri, 11 Aug 2023 04:42:20 +0000 (13:42 +0900)
src/walker.h

index 80b8fa8b9805110deae1a6772954520a826fd968..bf4268a84b5cf75dcd4e92370012c484fb8f17a2 100644 (file)
@@ -87,15 +87,9 @@ void Walker::update(float dt, const TBBS &bbs, unsigned int width,
           call_js_get_random() * ROAMING_WAIT_VARIANCE + ROAMING_WAIT_AMOUNT;
       unsigned int idx = call_js_get_random() * (float)bbs.size();
       float x = (float)(idx % width) - SURFACE_X_OFFSET;
-      float y = 0.0F;
+      float y = (bbs[idx].min.y + bbs[idx].max.y) / 2.0F;
       float z = (float)(idx / width) - SURFACE_Y_OFFSET;
 
-      Ray downwards{.position = Vector3{x, bbs[idx].max.y + 1.0F, z},
-                    .direction = Vector3{0.0F, -1.0F, 0.0F}};
-      if (GetRayCollisionBox(downwards, bbs[idx]).hit) {
-        y = (bbs[idx].min.y + bbs[idx].max.y) / 2.0F;
-      }
-
       set_body_pos(Vector3{x, y, z});
     }
   }