Created
March 30, 2020 06:14
-
-
Save RenaudRohlinger/30c6493a21431d66d7d21627477127b0 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