Showing the changes to scripts/developer (1 of 6 files). Show all
Unified · Split
| @@ -3,7 +3,7 @@ · 2 unmodified lines | ||
| 3 | 3 | var GRID_WORLD_SIZE = 100.0; |
| 4 | 4 | var GRID_WORLD_MARGIN = 5.0; |
| 5 | 5 | var GRID_WORLD_RESOLUTION = 30.0; |
| 6 | − var GRID_WORLD_DROP_HEIGHT = 5.0; | |
| 6 | + var GRID_WORLD_DROP_HEIGHT = 4.0; | |
| 7 | 7 | |
| 8 | 8 | var GRID_SIZE = GRID_WORLD_RESOLUTION; |
| 9 | 9 | var GRID_HALFSIZE = GRID_SIZE *0.5; |
| @@ -34,6 +34,7 @@ · 24 unmodified lines | ||
| 34 | 34 | } |
| 35 | 35 | |
| 36 | 36 | var OBJECT_DIM = { x: 0.5, y: 0.5, z: 0.5}; |
| 37 | + var CONE_DIM = { x: 0.3104, y: 0.3336, z: 0.3104}; | |
| 37 | 38 | var OBJECT_SPIN = { x: 0.5, y: 0.5, z: 0.5}; |
| 38 | 39 | |
| 39 | 40 | var shapeTypes = [ |
| @@ -53,29 +54,49 @@ function getTileColor(a, b, c) { · 13 unmodified lines | ||
| 53 | 54 | } |
| 54 | 55 | |
| 55 | 56 | function addObject(a, b, c, lifetime) { |
| 56 | − var center = getStagePosOriAt(a, b, c).pos; | |
| 57 | − | |
| 58 | − | |
| 59 | − | |
| 60 | − return (Entities.addEntity({ | |
| 61 | − type: "Shape", | |
| 62 | − shape: "Sphere", | |
| 63 | − name: "Backdrop", | |
| 64 | − color: getTileColor(a, b, c), | |
| 65 | − position: center, | |
| 66 | − rotation: stageOrientation, | |
| 67 | − dimensions: OBJECT_DIM, | |
| 68 | − lifetime: (lifetime === undefined) ? DEFAULT_LIFETIME : lifetime, | |
| 69 | − shapeType:shapeTypes[2], | |
| 70 | − dynamic: true, | |
| 71 | − gravity:{"x":0,"y":-9.8,"z":0}, | |
| 72 | − velocity:{"x":0,"y":0.02,"z":0}, | |
| 73 | − angularVelocity:OBJECT_SPIN, | |
| 74 | − restitution:0.70, | |
| 75 | − friction:0.01, | |
| 76 | − damping:0.001, | |
| 77 | − | |
| 78 | − })); | |
| 57 | + var center = getStagePosOriAt(a, b, c).pos; | |
| 58 | + var offset = (Math.abs(a) + (Math.abs(b) % 2)) % 2; | |
| 59 | + var makePrim = (offset > 0 ? true : false) ; | |
| 60 | + if (makePrim) { | |
| 61 | + return (Entities.addEntity({ | |
| 62 | + type: "Shape", | |
| 63 | + shape: "Sphere", | |
| 64 | + name: "object-" + a + b + c, | |
| 65 | + color: getTileColor(a, b, c), | |
| 66 | + position: center, | |
| 67 | + rotation: stageOrientation, | |
| 68 | + dimensions: OBJECT_DIM, | |
| 69 | + lifetime: (lifetime === undefined) ? DEFAULT_LIFETIME : lifetime, | |
| 70 | + shapeType:shapeTypes[2], | |
| 71 | + dynamic: true, | |
| 72 | + gravity:{"x":0,"y":-9.8,"z":0}, | |
| 73 | + velocity:{"x":0,"y":0.02,"z":0}, | |
| 74 | + angularVelocity:OBJECT_SPIN, | |
| 75 | + restitution:0.70, | |
| 76 | + friction:0.01, | |
| 77 | + damping:0.001, | |
| 78 | + | |
| 79 | + })); | |
| 80 | + } else { | |
| 81 | + return (Entities.addEntity({ | |
| 82 | + type: "Model", | |
| 83 | + name: "object-" + a + b + c, | |
| 84 | + position: center, | |
| 85 | + rotation: stageOrientation, | |
| 86 | + dimensions: OBJECT_DIM, | |
| 87 | + lifetime: (lifetime === undefined) ? DEFAULT_LIFETIME : lifetime, | |
| 88 | + modelURL: "https://hifi-content.s3.amazonaws.com/jimi/props/cones/trafficCone.fbx", | |
| 89 | + shapeType:shapeTypes[4], | |
| 90 | + dynamic: true, | |
| 91 | + gravity:{"x":0,"y":-9.8,"z":0}, | |
| 92 | + velocity:{"x":0,"y":0.02,"z":0}, | |
| 93 | + angularVelocity:OBJECT_SPIN, | |
| 94 | + restitution:0.70, | |
| 95 | + friction:0.01, | |
| 96 | + damping:0.01, | |
| 97 | + | |
| 98 | + })); | |
| 99 | + } | |
| 79 | 100 | } |
| 80 | 101 | |
| 81 | 102 | function addObjectGrid(backdrop, lifetime) { |