Josh Posted May 8, 2024 Posted May 8, 2024 In the next build that goes up, this will provide a good test of collision with mesh layers: #include "UltraEngine.h" #include "ComponentSystem.h" using namespace UltraEngine; const WString remotepath = "https://raw.githubusercontent.com/UltraEngine/Documentation/master/Assets/"; int main(int argc, const char* argv[]) { RegisterComponents(); //Get the primary display auto displays = GetDisplays(); //Create a window auto window = CreateWindow("Ultra Engine", 0, 0, 1280*2, 720*2, displays[0], WINDOW_CENTER | WINDOW_TITLEBAR); //Create a rendering framebuffer auto framebuffer = CreateFramebuffer(window); //Create a world auto world = CreateWorld(); //Create a camera //auto camera = CreateCamera(world); //camera->SetPosition(0, 2, 0); //camera->AddComponent<CameraControls>(); //camera->SetCollisionType(0); auto player = CreatePivot(world); player->SetPosition(0, 2, 0); auto component = player->AddComponent<FirstPersonControls>(); //component->camera->AddPostEffect(LoadPostEffect("Shaders/SSAO.fx")); //component->camera->SetClearColor(0.125); //Create a light auto light = CreateDirectionalLight(world); light->SetRotation(65, 35, 0); //Create a terrain auto terrain = CreateTerrain(world, 512, 512); //Add a mesh layer auto model = CreateBox(nullptr, 4); auto meshlayer = terrain->AddMeshLayer(model, 8.0f); meshlayer->Fill(); meshlayer->SetCollisionType(0, COLLISION_SCENE); meshlayer->SetShadows(0, true); //Main loop while (window->Closed() == false and window->KeyDown(KEY_ESCAPE) == false) { /*if (window->KeyHit(KEY_SPACE)) { ball->SetPosition(player->position); ball->SetVelocity(0, 0, 0); ball->AddForce(TransformNormal(0,0,1, player, nullptr) * 200.0); }*/ world->Update(); world->Render(framebuffer); } return 0; } 1 Quote Let's build cool stuff and have fun.
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.