forked from trent_larson/crowd-funder-for-time-pwa
totally remove code to make terrain bob up and down
This commit is contained in:
@@ -36,31 +36,6 @@ export default function createTerrain(props) {
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
||||
plane.tick = () => {};
|
||||
/**
|
||||
* This makes the terrain bob up and down.
|
||||
*
|
||||
let frame = 0;
|
||||
plane.tick = () => {
|
||||
frame += 0.01;
|
||||
// destructuring of the random values, the original position and the current vertex position
|
||||
const { array, originalPosition, randomValues } =
|
||||
plane.geometry.attributes.position;
|
||||
|
||||
// Animation for loop
|
||||
// In our vertex array, we have 3 coordinates: x, y and z. We are
|
||||
// only going to animate on ONE coordinate: the z coordinate.
|
||||
// This means we have to omit the x and y coords, hence the i+=3 in our loop.
|
||||
// Also, to access that y coordinate on each vertex, we have to add 2 to our
|
||||
// current i each time.
|
||||
for (let i = 0; i < array.length; i += 3) {
|
||||
// Accessing the z coord
|
||||
array[i + 2] =
|
||||
// Try switching this numbers up, or using sine instead of cosine, see how the animation changes
|
||||
originalPosition[i + 2] + Math.cos(frame + randomValues[i + 2]) * 0.002;
|
||||
}
|
||||
plane.geometry.attributes.position.needsUpdate = true;
|
||||
};
|
||||
**/
|
||||
|
||||
return plane;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user