Last active
March 4, 2021 07:48
-
-
Save Utopiah/eae1ff9b03aed820562579a2572c4efc 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
// no NAF owernship verification, if someone else pick a balloon, you don't control it anymore | |
// to clean up after yourself | |
// for (var el of [...greenBaloons, ...blueBaloons]) el.remove() | |
resetVerticalPosition(blueBaloons) | |
upwardFloat(blueBaloons) | |
stopFloat(blueBaloons) | |
resetVerticalPosition(greenBaloons) | |
upwardFloat(greenBaloons) | |
stopFloat(greenBaloons) | |
var hashBlueBaloon = "d1gD" | |
var hashGreenBaloon = "5eJ1" | |
// assumes you have added one balloon with those hashes then cloned a dozen | |
var greenBaloons = getElementsFromHash(hashGreenBaloon) | |
var blueBaloons = getElementsFromHash(hashBlueBaloon) | |
function upwardFloat(elements){ | |
for (var el of elements) | |
el.setAttribute("body-helper", { type: "dynamic", mass : 1, gravity: { x: 0, y: 0.5, z: 0 } }) | |
return elements | |
} | |
function resetVerticalPosition(elements){ | |
for (var el of elements) | |
el.object3D.position.y = 2 | |
return elements | |
} | |
function stopFloat(elements){ | |
for (var el of elements) | |
el.setAttribute("body-helper", { type: "static", gravity: { x: 0, y: 0, z: 0 } }) | |
return elements | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment