Skip to content

Commit

Permalink
fix falsey gravity zero bug
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexWarnes committed Aug 8, 2022
1 parent 1565104 commit 50a6ac3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions src/routes/showcase/cannon-fire/_routeLib/TargetGroup.svelte
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<script lang="ts">
import CubeTargets from './CubeTargets.svelte';
import TargetPlatform from './TargetPlatform.svelte';
export let targetCount: number = 10;
$: outerPlatforms = Array(targetCount - (targetCount % 3)).fill('x');
$: innerPlatforms = Array(targetCount % 3).fill('x');
</script>

{#each outerPlatforms as _, idx}
<CubeTargets />
<TargetPlatform />
{/each}
{#each innerPlatforms as _, idx}
<CubeTargets inner/>
<TargetPlatform inner/>
{/each}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
if (Math.random() > 0.8) {
return new MeshPhysicalMaterial({ color: randomColor(), ...glazeProps });
} else {
return new MeshStandardMaterial({ color: randomColor() });
return new MeshBasicMaterial({ color: randomColor() });
}
});
Expand All @@ -31,7 +31,7 @@
</script>

<script lang="ts">
import { BoxBufferGeometry, Color, MeshStandardMaterial, MeshPhysicalMaterial } from 'three';
import { BoxBufferGeometry, Color, MeshBasicMaterial, MeshPhysicalMaterial } from 'three';
import { InstancedMesh, Instance, Group, Mesh } from '@threlte/core';
import { RigidBody, Collider } from '@threlte/rapier';
import { randomColor, randomVec3 } from '$lib';
Expand All @@ -58,7 +58,7 @@
<InstancedMesh {geometry} material={cubeMaterials[idx]}>
<RigidBody
type={'dynamic'}
gravityScale={$gravity || 1}
gravityScale={typeof $gravity === 'number' ? $gravity : 1}
position={{ y: idx * 1.05 * cube.dimension + (groundHeight / 2 + cube.dimension / 2) }}
>
<Collider
Expand Down

0 comments on commit 50a6ac3

Please sign in to comment.