Created
March 30, 2020 06:15
-
-
Save RenaudRohlinger/53a11736401dd54c0a235003bda8d105 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function setInstancedMeshPositions(mesh, section) { | |
for ( var i = 0; i < mesh.count; i ++ ) { | |
var xStaticPosition = -sectionWidth * (i - 1); | |
var xSectionPosition = sectionWidth * section; | |
var x = xStaticPosition + xSectionPosition; | |
dummy.position.set(x, 0, 0); | |
dummy.updateMatrix(); | |
mesh.setMatrixAt( i, dummy.matrix ); | |
} | |
mesh.instanceMatrix.needsUpdate = true; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment