가운데 하나만 빼고 큐브 제거

This commit is contained in:
2026-03-08 12:18:17 +09:00
parent ddf5ff50ea
commit b8f05b42b3

View File

@@ -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));