Skip to content

Commit bd923be

Browse files
committed
disable average position.
1 parent c438aeb commit bd923be

1 file changed

Lines changed: 31 additions & 28 deletions

File tree

editor/client/main.ts

Lines changed: 31 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -302,34 +302,37 @@ Object.defineProperties(globalThis, {
302302
const editModeFlag = isPopout ? false : handshake.edit_mode;
303303
await setupGame(game, conn, editModeFlag);
304304

305-
if (editModeFlag) {
306-
const allEntities: Entity[] = [];
307-
let xAcc = 0;
308-
let yAcc = 0;
309-
const collectEntitiesRecursively = (entity: Entity) => {
310-
if (!entity.protected) allEntities.push(entity);
311-
for (const child of entity.children.values()) {
312-
if (child.name === "__EditorMetadata") continue;
313-
xAcc += child.globalTransform.position.x;
314-
yAcc += child.globalTransform.position.y;
315-
collectEntitiesRecursively(child);
316-
}
317-
};
318-
319-
for (const entity of game.world._.EditEntities.children.values()) {
320-
if (entity.id === "world/EditEntities/prefabs") {
321-
continue;
322-
}
323-
collectEntitiesRecursively(entity);
324-
}
325-
if (allEntities.length > 0) {
326-
const avgX = xAcc / allEntities.length;
327-
const avgY = yAcc / allEntities.length;
328-
const camera = game.local._.Camera.cast(Camera);
329-
camera.pos.x = avgX;
330-
camera.pos.y = avgY;
331-
}
332-
}
305+
// This averages the camera around the entities that exist. User complained that this put their camera in a weird spot
306+
// Likely due to an object really far from the origin. So I'm disabling it.
307+
308+
// if (editModeFlag) {
309+
// const allEntities: Entity[] = [];
310+
// let xAcc = 0;
311+
// let yAcc = 0;
312+
// const collectEntitiesRecursively = (entity: Entity) => {
313+
// if (!entity.protected) allEntities.push(entity);
314+
// for (const child of entity.children.values()) {
315+
// if (child.name === "__EditorMetadata") continue;
316+
// xAcc += child.globalTransform.position.x;
317+
// yAcc += child.globalTransform.position.y;
318+
// collectEntitiesRecursively(child);
319+
// }
320+
// };
321+
322+
// for (const entity of game.world._.EditEntities.children.values()) {
323+
// if (entity.id === "world/EditEntities/prefabs") {
324+
// continue;
325+
// }
326+
// collectEntitiesRecursively(entity);
327+
// }
328+
// if (allEntities.length > 0) {
329+
// const avgX = xAcc / allEntities.length;
330+
// const avgY = yAcc / allEntities.length;
331+
// const camera = game.local._.Camera.cast(Camera);
332+
// camera.pos.x = avgX;
333+
// camera.pos.y = avgY;
334+
// }
335+
// }
333336

334337
fonts.then(() => {
335338
game.entities.lookupByType(RichText).forEach(text => text.rerender());

0 commit comments

Comments
 (0)