Skip to content

Instantly share code, notes, and snippets.

@SamGondelman
Last active April 30, 2019 17:11
Show Gist options
  • Save SamGondelman/1e202a860a21dce0a4fc9c691ee8626a to your computer and use it in GitHub Desktop.
Save SamGondelman/1e202a860a21dce0a4fc9c691ee8626a to your computer and use it in GitHub Desktop.
(function() { // BEGIN LOCAL_SCOPE
var entities = [];
function getPos(x, y) {
var center = Vec3.sum(MyAvatar.position, Vec3.multiply(3, Quat.getFront(MyAvatar.orientation)));
return Vec3.sum(Vec3.sum(center, Vec3.multiply(Quat.getRight(MyAvatar.orientation), x)), Vec3.multiply(Quat.getUp(MyAvatar.orientation), y));
}
entities.push(Entities.addEntity({
type: "Model",
modelURL: "https://hifi-content.s3.amazonaws.com/samuel/fst/priscilla_scattering.fst",
position: getPos(-1, 1),
rotation: Quat.multiply(Quat.fromPitchYawRollDegrees(0, 180, 0), MyAvatar.orientation),
grab: { grabbable: false },
lifetime: 30
}));
entities.push(Entities.addEntity({
type: "Model",
modelURL: "https://hifi-content.s3.amazonaws.com/samuel/fst/priscilla_scattering_baked/priscilla_scattering.baked.fst",
position: getPos(1, 1),
rotation: Quat.multiply(Quat.fromPitchYawRollDegrees(0, 180, 0), MyAvatar.orientation),
grab: { grabbable: false },
lifetime: 30
}));
function cleanup() {
for (var i = 0; i < entities.length; i++) {
Entities.deleteEntity(entities[i]);
}
}
Script.scriptEnding.connect(cleanup);
}()); // END LOCAL_SCOPE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment