Created
July 7, 2016 21:30
-
-
Save hyperlogic/330c4feab3ed0d267ea90d40166c0fe4 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| // | |
| // Created by Triplelexx on 16/05/26 | |
| // Copyright 2016 High Fidelity, Inc. | |
| // | |
| // Creates an entity that can be sat apon | |
| // | |
| // Sitting animations adapted by Triplelexx from version obtained from Mixamo | |
| // Links provided to copies of original animations created by High Fidelity, Inc | |
| // This is due to issues requiring use of overrideRoleAnimation to chain animations and not knowing a better way | |
| // to reference them cross-platform. | |
| // | |
| // Distributed under the Apache License, Version 2.0. | |
| // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html | |
| var CHAIR_SCRIPT_URL = "https://gist.githubusercontent.com/hyperlogic/c00deec027da21ba5716162ba0356a4b/raw/114bb838592c0ef848eaf5166d223d0c19d01a1c/chair.js"; | |
| const MODEL_URL = "http://159.203.226.213/basic_chair/basic_chair.fbx"; | |
| const HULL_URL = "http://159.203.226.213/basic_chair/basic_chair_col.obj"; | |
| var startPosition = Vec3.sum(MyAvatar.position, Vec3.multiply(2.5, Quat.getFront(Camera.getOrientation()))); | |
| var chair = Entities.addEntity({ | |
| type: "Model", | |
| name: "Basic Chair", | |
| modelURL: MODEL_URL, | |
| position: startPosition, | |
| // These dimensions are correct for this model to be seated correctly with an avatar of default size | |
| dimensions: { | |
| x: 0.65, | |
| y: 1.0, | |
| z: 0.65 | |
| }, | |
| gravity: { | |
| x: 0.0, | |
| y: -9.8, | |
| z: 0.0 | |
| }, | |
| // a registration point of 0 is enforced in y | |
| registrationPoint: { | |
| x: 0.5, | |
| y: 0.0, | |
| z: 0.5 | |
| }, | |
| dynamic: false, | |
| collisionsWillMove: false, | |
| friction: 1.0, | |
| grabbable: false, | |
| damping: 0.2, | |
| angularDamping: 1.0, | |
| shapeType: "compound", | |
| compoundShapeURL: HULL_URL, | |
| script: CHAIR_SCRIPT_URL, | |
| userData: JSON.stringify({ | |
| allowScaling: true, | |
| allowSwivelling: false, | |
| manualSitTarget: { | |
| x: 0.0, | |
| y: 0.0, | |
| z: 0.0 | |
| }, | |
| grabbableKey: { | |
| grabbable: false | |
| } | |
| }) | |
| }); | |
| Script.stop(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment