Skip to content

Commit

Permalink
Adjusted ray
Browse files Browse the repository at this point in the history
  • Loading branch information
tracygardner committed Jul 24, 2024
1 parent 219fe24 commit f3f46a1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
2 changes: 1 addition & 1 deletion dev-dist/sw.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ define(['./workbox-07658ed7'], (function (workbox) { 'use strict';
"revision": "3ca0b8505b4bec776b69afdba2768812"
}, {
"url": "index.html",
"revision": "0.mstmvjckovg"
"revision": "0.shls3vgrg1g"
}], {});
workbox.cleanupOutdatedCaches();
workbox.registerRoute(new workbox.NavigationRoute(workbox.createHandlerBoundToURL("index.html"), {
Expand Down
11 changes: 5 additions & 6 deletions flock.js
Original file line number Diff line number Diff line change
Expand Up @@ -342,10 +342,10 @@ function createCapsuleFromBoundingBox(mesh, scene) {
boundingInfo.boundingBox.minimumWorld.z;

// Calculate the radius as the min of the width and depth
const radius = Math.min(width, depth) / 2;
const radius = Math.max(width, depth) / 2;

// Calculate the effective height of the capsule's cylindrical part
const cylinderHeight = Math.max(0, height - (2 * radius));
const cylinderHeight = Math.max(0, height - 2 * radius);

// Calculate the center of the bounding box
const center = new BABYLON.Vector3(0, 0, 0);
Expand Down Expand Up @@ -373,7 +373,6 @@ function createCapsuleFromBoundingBox(mesh, scene) {
return shape;
}


export async function tint(modelName, color) {
await retryUntilFound(modelName, (mesh) => {
if (mesh.material) {
Expand Down Expand Up @@ -771,12 +770,12 @@ function checkIfOnSurface(mesh) {
//rayHelper.show(window.scene);
const hit = window.scene.pickWithRay(ray);

console.log(`Raycasting from: ${rayOrigin.toString()}`);
console.log(
//console.log(`Raycasting from: ${rayOrigin.toString()}`);
//console.log(
`Ray hit: ${hit.hit}, Distance: ${hit.distance}, Picked Mesh: ${hit.pickedMesh ? hit.pickedMesh.name : "None"}`,
);

return hit.hit && hit.pickedMesh !== null && hit.distance <= 0.3;
return hit.hit && hit.pickedMesh !== null && hit.distance <= 0.1;
}

export function keyPressed(key) {
Expand Down

0 comments on commit f3f46a1

Please sign in to comment.