Skip to content

Instantly share code, notes, and snippets.

@hyperlogic
Created April 30, 2016 16:49
Show Gist options
  • Save hyperlogic/7ba9ada2e1e1bfef172659500a0a66e5 to your computer and use it in GitHub Desktop.
Save hyperlogic/7ba9ada2e1e1bfef172659500a0a66e5 to your computer and use it in GitHub Desktop.
creates a giant kitty image
var MODEL_URL = "http://hifi-production.s3.amazonaws.com/tutorials/pictureFrame/finalFrame.fbx";
function getPosition() {
// Always put it 5 meters in front of you
var position = MyAvatar.position;
var yaw = MyAvatar.bodyYaw + MyAvatar.getHeadFinalYaw();
var rads = (yaw / 180) * Math.PI;
position.y += 0.5;
position.x += - 5 * Math.sin(rads);
position.z += - 5 * Math.cos(rads);
print(JSON.stringify(position));
return position;
}
var props = {
name: 'picture-frame',
type: 'Model',
position: getPosition(),
rotation: Quat.multiply(MyAvatar.orientation, {x: 0, y: 1, z: 0, w: 0}),
modelURL: MODEL_URL,
dynamic: true,
};
var model = Entities.addEntity(props);
var IMAGE_URL = "http://cdn.attackofthecute.com/November-05-2011-20-44-24-Pingfan43newgallerya600600.jpeg";
Entities.editEntity(model, { textures: JSON.stringify({ Picture: IMAGE_URL }) });
@imgntn
Copy link

imgntn commented Apr 30, 2016

🐱

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment