Skip to content

Instantly share code, notes, and snippets.

@Utopiah
Last active March 4, 2021 07:48
Show Gist options
  • Save Utopiah/eae1ff9b03aed820562579a2572c4efc to your computer and use it in GitHub Desktop.
Save Utopiah/eae1ff9b03aed820562579a2572c4efc to your computer and use it in GitHub Desktop.
// 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