From b8f05b42b3d5122930512669cbfc2c42033f232c Mon Sep 17 00:00:00 2001 From: tymmkang Date: Sun, 8 Mar 2026 12:18:17 +0900 Subject: [PATCH] =?UTF-8?q?=EA=B0=80=EC=9A=B4=EB=8D=B0=20=ED=95=98?= =?UTF-8?q?=EB=82=98=EB=A7=8C=20=EB=B9=BC=EA=B3=A0=20=ED=81=90=EB=B8=8C=20?= =?UTF-8?q?=EC=A0=9C=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Source/MainScene.cpp | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/Source/MainScene.cpp b/Source/MainScene.cpp index 1701df8..9422774 100644 --- a/Source/MainScene.cpp +++ b/Source/MainScene.cpp @@ -81,19 +81,13 @@ bool MainScene::init() float gridWidth = (gridSize - 1) * step; Vec3 gridCenter(gridWidth / 2.0f, 0.0f, gridWidth / 2.0f); - // Create 10x10 cubes using MeshRenderer and the generated cube.obj - for (int i = 0; i < gridSize; ++i) + // Create a single cube at the center of the grid area + auto centerCube = MeshRenderer::create("cube.obj"); + if (centerCube) { - for (int j = 0; j < gridSize; ++j) - { - auto cube = MeshRenderer::create("cube.obj"); - if (cube) - { - cube->setPosition3D(Vec3(i * step, 0.0f, j * step)); - cube->setCameraMask((unsigned short)CameraFlag::USER1); - this->addChild(cube); - } - } + centerCube->setPosition3D(gridCenter); + centerCube->setCameraMask((unsigned short)CameraFlag::USER1); + this->addChild(centerCube); } // Add Lights @@ -151,7 +145,7 @@ bool MainScene::init() // The label and menu will use the default camera (CameraFlag::DEFAULT) // Add a label for confirmation - auto label = Label::createWithTTF("10x10 Cube Grid", "fonts/Marker Felt.ttf", 24); + auto label = Label::createWithTTF("Center Cube", "fonts/Marker Felt.ttf", 24); if (label) { label->setPosition(Vec2(origin.x + visibleSize.width / 2, origin.y + visibleSize.height - 30));