From ddf5ff50eaf39de3d59e27312a05b5bd925e057a Mon Sep 17 00:00:00 2001 From: tymmkang Date: Sun, 8 Mar 2026 03:03:29 +0900 Subject: [PATCH] =?UTF-8?q?=EB=B0=94=EB=8B=A5=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Source/MainScene.cpp | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/Source/MainScene.cpp b/Source/MainScene.cpp index 389a7b3..1701df8 100644 --- a/Source/MainScene.cpp +++ b/Source/MainScene.cpp @@ -73,7 +73,7 @@ bool MainScene::init() // Grid settings const int gridSize = 10; const float cubeDim = 1.0f; - const float spacing = 0.1f; + const float spacing = 0.25f; const float step = cubeDim + spacing; // Calculate center of the grid @@ -107,6 +107,25 @@ bool MainScene::init() ambLight->setCameraMask((unsigned short)CameraFlag::USER1); this->addChild(ambLight); + // Add a Ground Plane + auto ground = MeshRenderer::create("cube.obj"); + if (ground) + { + // Calculate the exact size needed to cover the grid + // Grid size is (gridSize-1)*step + cubeDim + float actualSize = gridWidth + cubeDim; + float padding = 2.0f; // Increased padding to 2.0 + + ground->setScaleX(actualSize + padding); + ground->setScaleZ(actualSize + padding); + ground->setScaleY(0.25f); // Thickness set to 0.25 + // Positioned so the top surface is at Y = -0.5 (cubes are at Y=0 with height 1) + ground->setPosition3D(Vec3(gridCenter.x, -0.5f - 0.125f, gridCenter.z)); + ground->setCameraMask((unsigned short)CameraFlag::USER1); + ground->setColor(Color3B(100, 100, 100)); + this->addChild(ground); + } + // Setup Camera for Quarter View (Isometric-like) _camera3D = Camera::createPerspective(60.0f, visibleSize.width / visibleSize.height, 0.1f, 1000.0f); _camera3D->setCameraFlag(CameraFlag::USER1);