Skip to content

Instantly share code, notes, and snippets.

@CedricGuillemet
Created January 20, 2021 14:03
Show Gist options
  • Save CedricGuillemet/599b9556aa50339876a8fe08e04dcda0 to your computer and use it in GitHub Desktop.
Save CedricGuillemet/599b9556aa50339876a8fe08e04dcda0 to your computer and use it in GitHub Desktop.
trail.data.shift(); trail.data.shift(); trail.data.shift(); trail.data.shift();
trail.data.push(newPos.x, newPos.y, newPos.z, 0.);
if (!trail.texture) {
trail.texture = BABYLON.RawTexture.CreateRGBATexture(new Float32Array(trail.data), 1, trail.data.length / 4, scene, false, false, BABYLON.Texture.LINEAR_LINEAR, BABYLON.Engine.TEXTURETYPE_FLOAT);
trail.trackSampler0Block.texture = trail.texture;
trail.trackSampler1Block.texture = trail.texture;
} else {
trail.texture.update(new Float32Array(trail.data));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment