Simplify and fix collider rotation

This commit is contained in:
Brian Peiris 2018-08-30 15:39:39 -07:00
Родитель 6e6eb859ea
Коммит 82912cb5ad
4 изменённых файлов: 27 добавлений и 23 удалений

32
package-lock.json сгенерированный
Просмотреть файл

@ -5774,12 +5774,14 @@
"balanced-match": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz",
"integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c="
"integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=",
"optional": true
},
"brace-expansion": {
"version": "1.1.11",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz",
"integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==",
"optional": true,
"requires": {
"balanced-match": "^1.0.0",
"concat-map": "0.0.1"
@ -5794,17 +5796,20 @@
"code-point-at": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz",
"integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c="
"integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=",
"optional": true
},
"concat-map": {
"version": "0.0.1",
"resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
"integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s="
"integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=",
"optional": true
},
"console-control-strings": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/console-control-strings/-/console-control-strings-1.1.0.tgz",
"integrity": "sha1-PXz0Rk22RG6mRL9LOVB/mFEAjo4="
"integrity": "sha1-PXz0Rk22RG6mRL9LOVB/mFEAjo4=",
"optional": true
},
"core-util-is": {
"version": "1.0.2",
@ -5921,7 +5926,8 @@
"inherits": {
"version": "2.0.3",
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz",
"integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4="
"integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=",
"optional": true
},
"ini": {
"version": "1.3.5",
@ -5933,6 +5939,7 @@
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz",
"integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=",
"optional": true,
"requires": {
"number-is-nan": "^1.0.0"
}
@ -5947,6 +5954,7 @@
"version": "3.0.4",
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz",
"integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==",
"optional": true,
"requires": {
"brace-expansion": "^1.1.7"
}
@ -5954,12 +5962,14 @@
"minimist": {
"version": "0.0.8",
"resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz",
"integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0="
"integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=",
"optional": true
},
"minipass": {
"version": "2.2.4",
"resolved": "https://registry.npmjs.org/minipass/-/minipass-2.2.4.tgz",
"integrity": "sha512-hzXIWWet/BzWhYs2b+u7dRHlruXhwdgvlTMDKC6Cb1U7ps6Ac6yQlR39xsbjWJE377YTCtKwIXIpJ5oP+j5y8g==",
"optional": true,
"requires": {
"safe-buffer": "^5.1.1",
"yallist": "^3.0.0"
@ -5978,6 +5988,7 @@
"version": "0.5.1",
"resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz",
"integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=",
"optional": true,
"requires": {
"minimist": "0.0.8"
}
@ -6058,7 +6069,8 @@
"number-is-nan": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz",
"integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0="
"integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=",
"optional": true
},
"object-assign": {
"version": "4.1.1",
@ -6070,6 +6082,7 @@
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz",
"integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=",
"optional": true,
"requires": {
"wrappy": "1"
}
@ -6191,6 +6204,7 @@
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz",
"integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=",
"optional": true,
"requires": {
"code-point-at": "^1.0.0",
"is-fullwidth-code-point": "^1.0.0",
@ -13473,8 +13487,8 @@
}
},
"three": {
"version": "github:mozillareality/three.js#09b27a6628e7dd5422db2ebfafa24d198ddb0b16",
"from": "github:mozillareality/three.js#09b27a6628e7dd5422db2ebfafa24d198ddb0b16"
"version": "github:mozillareality/three.js#023e0f6a8c66c2fdecf88da4b5ea01928d391f61",
"from": "github:mozillareality/three.js#023e0f6a8"
},
"throttle-debounce": {
"version": "2.0.1",

Просмотреть файл

@ -82,7 +82,7 @@
"react-tooltip": "^3.6.1",
"selfsigned": "^1.10.3",
"signals": "^1.0.0",
"three": "github:mozillareality/three.js#09b27a6628e7dd5422db2ebfafa24d198ddb0b16",
"three": "github:mozillareality/three.js#023e0f6a8",
"throttle-debounce": "^2.0.1",
"ws": "^5.2.0"
},

Просмотреть файл

@ -38,7 +38,6 @@ import addChildAtIndex from "./utils/addChildAtIndex";
import SceneLoaderError from "./SceneLoaderError";
import sortEntities from "./utils/sortEntities";
import GLTFModelComponent from "./components/GLTFModelComponent";
import { BoxCollider } from "./components/BoxColliderComponent";
/**
* @author mrdoob / http://mrdoob.com/
@ -1119,8 +1118,6 @@ export default class Editor {
helper = new SpokeHemisphereLightHelper(object, 1);
} else if (object instanceof THREE.SkinnedMesh) {
helper = new THREE.SkeletonHelper(object);
} else if (object instanceof BoxCollider) {
helper = new THREE.BoxHelper(object, 0x00ff00);
} else {
// no helper for this object type
return;

Просмотреть файл

@ -1,14 +1,6 @@
import THREE from "../three";
import TransformComponent from "./TransformComponent";
// BoxCollider exists because the editor needs something to create a helper for.
export class BoxCollider extends THREE.Mesh {
constructor(geometry, material) {
super(geometry, material);
this.visible = false;
}
}
export default class BoxColliderComponent extends TransformComponent {
static componentName = "box-collider";
@ -26,13 +18,14 @@ export default class BoxColliderComponent extends TransformComponent {
static dontExportProps = false;
static async inflate(node, _props) {
const box = new BoxCollider(BoxColliderComponent._geometry);
const boxMesh = new THREE.Mesh(this._geometry, this._material);
boxMesh.userData._dontExport = true;
const box = new THREE.BoxHelper(boxMesh, 0x00ff00);
box.userData._dontExport = true;
box.userData._dontShowInHierarchy = true;
box.userData._inflated = true;
const component = await this._getOrCreateComponent(node, _props);
node.add(box);
node.updateMatrixWorld(true);
return component;
}
}