Skip to content

Commit 1e2e5bb

Browse files
committed
Revert "Scene grabbables support"
This reverts commit ec12e4c.
1 parent 67aaeaf commit 1e2e5bb

29 files changed

+142
-492
lines changed

src/bit-components.js

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,7 @@ export const Owned = defineComponent();
2121
export const EntityStateDirty = defineComponent();
2222
export const NetworkedMediaFrame = defineComponent({
2323
capturedNid: Types.ui32,
24-
scale: [Types.f32, 3],
25-
flags: Types.ui8,
26-
mediaType: Types.ui8
24+
scale: [Types.f32, 3]
2725
});
2826
NetworkedMediaFrame.capturedNid[$isStringType] = true;
2927

@@ -121,11 +119,7 @@ export const Rigidbody = defineComponent({
121119
activationState: Types.ui8,
122120
collisionFilterGroup: Types.ui32,
123121
collisionFilterMask: Types.ui32,
124-
flags: Types.ui8,
125-
initialCollisionFilterMask: Types.ui32
126-
});
127-
export const NetworkedRigidBody = defineComponent({
128-
prevType: Types.ui8
122+
flags: Types.ui8
129123
});
130124
export const PhysicsShape = defineComponent({
131125
bodyId: Types.ui16,

src/bit-systems/camera-tool.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ function rotateWithRightClick(world, camera) {
211211
userinput.get(paths.device.mouse.buttonRight)
212212
) {
213213
const rightCursor = anyEntityWith(world, RemoteRight);
214-
physicsSystem.updateRigidBody(camera, { type: "kinematic" });
214+
physicsSystem.updateRigidBodyOptions(camera, { type: "kinematic" });
215215
transformSystem.startTransform(world.eid2obj.get(camera), world.eid2obj.get(rightCursor), {
216216
mode: "cursor"
217217
});

src/bit-systems/interactable-system.ts

Lines changed: 0 additions & 37 deletions
This file was deleted.

src/bit-systems/media-loading.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,7 @@ export function mediaLoadingSystem(world: HubsWorld) {
359359
jobs.add(eid, clearRollbacks => loadAndAnimateMedia(world, eid, clearRollbacks));
360360
});
361361

362-
mediaLoadingExitQuery(world).forEach(function (eid: EntityID) {
362+
mediaLoadingExitQuery(world).forEach(function (eid) {
363363
jobs.stop(eid);
364364

365365
if (MediaImageLoaderData.has(eid)) {
@@ -406,7 +406,7 @@ export function mediaLoadingSystem(world: HubsWorld) {
406406
}
407407
});
408408

409-
mediaLoadingQuery(world).forEach((eid: EntityID) => {
409+
mediaLoadingQuery(world).forEach(eid => {
410410
const mediaLoaderObj = world.eid2obj.get(eid)!;
411411
transformPosition.fromArray(NetworkedTransform.position[eid]);
412412
if (mediaLoaderObj.position.near(transformPosition, 0.001)) {
@@ -417,7 +417,7 @@ export function mediaLoadingSystem(world: HubsWorld) {
417417
mediaLoadedEnterQuery(world).forEach(() => APP.scene?.emit("listed_media_changed"));
418418
mediaLoadedExitQuery(world).forEach(() => APP.scene?.emit("listed_media_changed"));
419419

420-
mediaRefreshEnterQuery(world).forEach((eid: EntityID) => {
420+
mediaRefreshEnterQuery(world).forEach(eid => {
421421
if (!jobs.has(eid)) {
422422
jobs.add(eid, clearRollbacks => refreshMedia(world, eid, clearRollbacks));
423423
}

src/bit-systems/object-menu.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ function startRotation(world: HubsWorld, menuEid: EntityID, targetEid: EntityID)
105105
}
106106
const transformSystem = APP.scene!.systems["transform-selected-object"];
107107
const physicsSystem = AFRAME.scenes[0].systems["hubs-systems"].physicsSystem;
108-
physicsSystem.updateRigidBody(Rigidbody.bodyId[targetEid], { type: "kinematic" });
108+
physicsSystem.updateRigidBodyOptions(Rigidbody.bodyId[targetEid], { type: "kinematic" });
109109
const rightCursorEid = anyEntityWith(world, RemoteRight)!;
110110
transformSystem.startTransform(world.eid2obj.get(targetEid)!, world.eid2obj.get(rightCursorEid)!, {
111111
mode: TRANSFORM_MODE.CURSOR
@@ -137,7 +137,7 @@ function startScaling(world: HubsWorld, menuEid: EntityID, targetEid: EntityID)
137137
// TODO: Remove the dependency with AFRAME
138138
const transformSystem = (AFRAME as any).scenes[0].systems["transform-selected-object"];
139139
const physicsSystem = AFRAME.scenes[0].systems["hubs-systems"].physicsSystem;
140-
physicsSystem.updateRigidBody(Rigidbody.bodyId[targetEid], { type: "kinematic" });
140+
physicsSystem.updateRigidBodyOptions(Rigidbody.bodyId[targetEid], { type: "kinematic" });
141141
const rightCursorEid = anyEntityWith(world, RemoteRight)!;
142142
scalingHandler = new ScalingHandler(world.eid2obj.get(targetEid), transformSystem);
143143
scalingHandler!.objectToScale = world.eid2obj.get(targetEid);

src/bit-systems/scene-loading.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import {
77
HeightFieldTag,
88
NavMesh,
99
Networked,
10+
PhysicsShape,
1011
SceneLoader,
1112
ScenePreviewCamera,
1213
SceneRoot,

src/components/body-helper.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import { addComponent, removeComponent } from "bitecs";
22
import { CONSTANTS } from "three-ammo";
33
import { Rigidbody } from "../bit-components";
4-
import { updateBodyParams } from "../inflators/rigid-body";
54
const ACTIVATION_STATE = CONSTANTS.ACTIVATION_STATE,
65
TYPE = CONSTANTS.TYPE;
76

@@ -42,7 +41,6 @@ AFRAME.registerComponent("body-helper", {
4241
this.uuid = this.system.addBody(this.el.object3D, this.data);
4342
const eid = this.el.object3D.eid;
4443
addComponent(APP.world, Rigidbody, eid);
45-
updateBodyParams(eid, this.data);
4644
Rigidbody.bodyId[eid] = this.uuid; //uuid is a lie, it's actually an int
4745
},
4846

src/components/media-loader.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -284,10 +284,8 @@ AFRAME.registerComponent("media-loader", {
284284

285285
// TODO this does duplicate work in some cases, but finish() is the only consistent place to do it
286286
const contentBounds = getBox(this.el.object3D, this.el.getObject3D("mesh")).getSize(new THREE.Vector3());
287-
if (el.eid) {
288-
addComponent(APP.world, MediaContentBounds, el.eid);
289-
MediaContentBounds.bounds[el.eid].set(contentBounds.toArray());
290-
}
287+
addComponent(APP.world, MediaContentBounds, el.eid);
288+
MediaContentBounds.bounds[el.eid].set(contentBounds.toArray());
291289

292290
el.emit("media-loaded");
293291
};

src/constants.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export enum COLLISION_LAYERS {
1111
DEFAULT_INTERACTABLE = INTERACTABLES | ENVIRONMENT | AVATAR | HANDS | MEDIA_FRAMES,
1212
UNOWNED_INTERACTABLE = INTERACTABLES | HANDS | MEDIA_FRAMES,
1313
DEFAULT_SPAWNER = INTERACTABLES | HANDS
14-
}
14+
};
1515

1616
export enum AAModes {
1717
NONE = "NONE",

src/inflators/media-frame.js

Lines changed: 10 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -15,28 +15,14 @@ export const AxisAlignType = {
1515
};
1616

1717
export const MEDIA_FRAME_FLAGS = {
18-
SCALE_TO_BOUNDS: 1 << 0,
19-
ACTIVE: 1 << 1,
20-
SNAP_TO_CENTER: 1 << 2,
21-
LOCKED: 1 << 3
22-
};
23-
24-
export const MediaTypes = {
25-
all: MediaType.ALL,
26-
"all-2d": MediaType.ALL_2D,
27-
model: MediaType.MODEL,
28-
image: MediaType.IMAGE,
29-
video: MediaType.VIDEO,
30-
pdf: MediaType.PDF
18+
SCALE_TO_BOUNDS: 1 << 0
3119
};
3220

3321
const DEFAULTS = {
3422
bounds: { x: 1, y: 1, z: 1 },
3523
mediaType: "all",
3624
scaleToBounds: true,
37-
align: { x: "center", y: "center", z: "center" },
38-
active: true,
39-
locked: false
25+
align: { x: "center", y: "center", z: "center" }
4026
};
4127
export function inflateMediaFrame(world, eid, componentProps) {
4228
componentProps = Object.assign({}, DEFAULTS, componentProps);
@@ -82,16 +68,17 @@ export function inflateMediaFrame(world, eid, componentProps) {
8268
addComponent(world, MediaFrame, eid, true);
8369
addComponent(world, NetworkedMediaFrame, eid, true);
8470

85-
NetworkedMediaFrame.flags[eid] |= MEDIA_FRAME_FLAGS.ACTIVE;
86-
if (componentProps.snapToCenter) {
87-
NetworkedMediaFrame.flags[eid] |= MEDIA_FRAME_FLAGS.SNAP_TO_CENTER;
88-
}
89-
9071
if (!hasComponent(world, Networked, eid)) addComponent(world, Networked, eid);
9172

9273
// Media types accepted
93-
MediaFrame.mediaType[eid] = MediaTypes[componentProps.mediaType];
94-
NetworkedMediaFrame.mediaType[eid] = MediaFrame.mediaType[eid];
74+
MediaFrame.mediaType[eid] = {
75+
all: MediaType.ALL,
76+
"all-2d": MediaType.ALL_2D,
77+
model: MediaType.MODEL,
78+
image: MediaType.IMAGE,
79+
video: MediaType.VIDEO,
80+
pdf: MediaType.PDF
81+
}[componentProps.mediaType];
9582
// Bounds
9683
MediaFrame.bounds[eid].set([componentProps.bounds.x, componentProps.bounds.y, componentProps.bounds.z]);
9784
// Axis alignment
@@ -114,15 +101,6 @@ export function inflateMediaFrame(world, eid, componentProps) {
114101
if (componentProps.scaleToBounds) flags |= MEDIA_FRAME_FLAGS.SCALE_TO_BOUNDS;
115102
MediaFrame.flags[eid] = flags;
116103

117-
if (componentProps.active) {
118-
NetworkedMediaFrame.flags[eid] |= MEDIA_FRAME_FLAGS.ACTIVE;
119-
MediaFrame.flags[eid] |= MEDIA_FRAME_FLAGS.ACTIVE;
120-
}
121-
if (componentProps.locked) {
122-
NetworkedMediaFrame.flags[eid] |= MEDIA_FRAME_FLAGS.LOCKED;
123-
MediaFrame.flags[eid] |= MEDIA_FRAME_FLAGS.LOCKED;
124-
}
125-
126104
inflateRigidBody(world, eid, {
127105
type: Type.KINEMATIC,
128106
collisionGroup: COLLISION_LAYERS.MEDIA_FRAMES,

src/inflators/model.tsx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,15 @@ function camelCase(s: string) {
1414
export type ModelParams = { model: Object3D };
1515

1616
// These components are all handled in some special way, not through inflators
17-
const ignoredComponents = ["visible", "frustum", "frustrum", "shadow", "animation-mixer", "loop-animation"];
17+
const ignoredComponents = [
18+
"visible",
19+
"frustum",
20+
"frustrum",
21+
"shadow",
22+
"networked",
23+
"animation-mixer",
24+
"loop-animation"
25+
];
1826

1927
function inflateComponents(
2028
world: HubsWorld,

0 commit comments

Comments
 (0)