Skip to content

Instantly share code, notes, and snippets.

@RenaudRohlinger
Last active March 30, 2020 06:08
Show Gist options
  • Save RenaudRohlinger/a726608a81d1574afde521d2f5c782d0 to your computer and use it in GitHub Desktop.
Save RenaudRohlinger/a726608a81d1574afde521d2f5c782d0 to your computer and use it in GitHub Desktop.
function loopFunction() {
var distance = Math.round(camera.position.x / sectionWidth)
if (distance !== this.loopSectionPosition) {
loopSectionPosition = distance
setInstancedMeshPositions(mesh, loopSectionPosition)
}
}
function render() {
// move the camera
camera.position.x += 5.
loopFunction()
renderer.render( scene, camera )
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment