Skip to content

Instantly share code, notes, and snippets.

@hyperlogic
Last active July 14, 2016 00:46
Show Gist options
  • Select an option

  • Save hyperlogic/a2e63ac0e70d2e9d132bcc37316c6f30 to your computer and use it in GitHub Desktop.

Select an option

Save hyperlogic/a2e63ac0e70d2e9d132bcc37316c6f30 to your computer and use it in GitHub Desktop.
var spawnPoint = Vec3.sum(MyAvatar.position, Vec3.multiply(4.0, Quat.getFront(Camera.getOrientation())));
var right = Vec3.cross(Quat.getFront(Camera.getOrientation()), Quat.getUp(Camera.getOrientation()));
spawnPoint = Vec3.sum(spawnPoint, Vec3.multiply(-1, right));
var MODEL_URL = "https://s3.amazonaws.com/hifi-public/tony/axes.fbx";
var overlays = [];
// this model should be 1/10th a meter tall, very small
overlays.push(Overlays.addOverlay("model", {
url: MODEL_URL,
position: spawnPoint,
rotation: Camera.getOrientation()
}));
// this model should be 1 meter tall
spawnPoint = Vec3.sum(spawnPoint, right);
overlays.push(Overlays.addOverlay("model", {
url: MODEL_URL,
position: spawnPoint,
rotation: Camera.getOrientation(),
scale: 10
}));
// this model should also be 1 meter tall
spawnPoint = Vec3.sum(spawnPoint, right);
overlays.push(Overlays.addOverlay("model", {
url: MODEL_URL,
position: spawnPoint,
rotation: Camera.getOrientation(),
dimensions: 1
}));
// this model should also be 1 meter tall
spawnPoint = Vec3.sum(spawnPoint, right);
overlays.push(Overlays.addOverlay("model", {
url: MODEL_URL,
position: spawnPoint,
rotation: Camera.getOrientation(),
scale: 2,
dimensions: 0.5
}));
Script.scriptEnding.connect(function () {
overlays.forEach(function (overlay) {
Overlays.deleteOverlay(overlay);
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment