가운데 하나만 빼고 큐브 제거
This commit is contained in:
@@ -81,19 +81,13 @@ bool MainScene::init()
|
|||||||
float gridWidth = (gridSize - 1) * step;
|
float gridWidth = (gridSize - 1) * step;
|
||||||
Vec3 gridCenter(gridWidth / 2.0f, 0.0f, gridWidth / 2.0f);
|
Vec3 gridCenter(gridWidth / 2.0f, 0.0f, gridWidth / 2.0f);
|
||||||
|
|
||||||
// Create 10x10 cubes using MeshRenderer and the generated cube.obj
|
// Create a single cube at the center of the grid area
|
||||||
for (int i = 0; i < gridSize; ++i)
|
auto centerCube = MeshRenderer::create("cube.obj");
|
||||||
|
if (centerCube)
|
||||||
{
|
{
|
||||||
for (int j = 0; j < gridSize; ++j)
|
centerCube->setPosition3D(gridCenter);
|
||||||
{
|
centerCube->setCameraMask((unsigned short)CameraFlag::USER1);
|
||||||
auto cube = MeshRenderer::create("cube.obj");
|
this->addChild(centerCube);
|
||||||
if (cube)
|
|
||||||
{
|
|
||||||
cube->setPosition3D(Vec3(i * step, 0.0f, j * step));
|
|
||||||
cube->setCameraMask((unsigned short)CameraFlag::USER1);
|
|
||||||
this->addChild(cube);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add Lights
|
// Add Lights
|
||||||
@@ -151,7 +145,7 @@ bool MainScene::init()
|
|||||||
// The label and menu will use the default camera (CameraFlag::DEFAULT)
|
// The label and menu will use the default camera (CameraFlag::DEFAULT)
|
||||||
|
|
||||||
// Add a label for confirmation
|
// 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)
|
if (label)
|
||||||
{
|
{
|
||||||
label->setPosition(Vec2(origin.x + visibleSize.width / 2, origin.y + visibleSize.height - 30));
|
label->setPosition(Vec2(origin.x + visibleSize.width / 2, origin.y + visibleSize.height - 30));
|
||||||
|
|||||||
Reference in New Issue
Block a user