Jump to content

SpiderPig

Members
  • Posts

    2,348
  • Joined

  • Last visited

Everything posted by SpiderPig

  1. auto pixmap = CreatePixmap(width, height, TEXTURE_R16); pixmap->Save("Map.r16"); This fails to save, should it be possible to do? Or do I need a plugin? 🤔
  2. terrain->SetHeightmap(pixmap); I'd like to create a pixmap in code and then set it as a terrain heightmap.
  3. Every once in while I get this error when opening up the client app and I will then have to enter my details again. It usually happens after a long period of not opening the client up, maybe a week or two... Is it a brief network issue it's detecting or perhaps something else as my internet is fine as far as I can tell...
  4. I have world machine but it crashes at 32,768, the biggest it will let me build is 16,384. Are 4 tiles good enough? Can you join them with Ultra?
  5. Hi, I've added those missing files. These libs however are missing... do we have to generate them ourselves somehow? #pragma comment(lib, "Scintilla_d.lib") #pragma comment(lib, "Lexilla_d.lib")
  6. That's okay. If you need any further help just post some code and I can take a look for you.
  7. I think the pick idea would work better. Like you say, you would have to roughly aim at the enemy first. Are you using C++ or LUA? I haven't used Leadwerks in ages and right now I'm pressed for time, but here's the general idea (syntax is off, I'm using the tippy top of my head) Something like this perhaps... there would be more to it than this. float radius = 0.25f; PickInfo pick_info; Vec3 player_pos = player->GetPosition(true); Vec3 target_position = camera->UnProject(screen_centre);//or Project?? I forget if(Pick(player_pos, target_pos, pick_info, radius) == true){ if(pick_info.entity == enemy) { Vec3 enemy_pos = pick_info.entity->GetPosition(true); player->Point(enemy_pos + an_offset_maybe) } } You could use distance as well and get the angle to each enemy to figure out the closest in distance and angle...
  8. I see we can change the size of a pixmap block like so, but I think it would be better if there was a 'size' parameter for AddBlock(). int index = AddBlock(pixmap, 0, 0, Vec4(1.0f)); blocks[index].size.y += 100;
  9. I'm getting a popup error when writing the pixels of a non-square pixmap. This program crashes when x = 8 and y = 0. I assume its just testing the x value against the y size. #include "UltraEngine.h" #include "ComponentSystem.h" using namespace UltraEngine; int main(int argc, const char* argv[]) { auto displays = GetDisplays(); auto window = CreateWindow("Ultra Engine", 0, 0, 1440, 900, displays[0]); auto framebuffer = CreateFramebuffer(window); auto world = CreateWorld(); auto camera = CreateCamera(world); camera->Move(0, 2, -3); camera->SetClearColor(1, 0, 0); auto light = CreateDirectionalLight(world); light->SetRotation(35, 35, 35); auto floor = CreateBox(world, 100.0f, 0.5f, 100.0f); auto default_font = LoadFont("Fonts\\arial.ttf"); auto ui = CreateInterface(world, default_font, framebuffer->size); ui->SetRenderLayers(2); ui->root->SetColor(0.0f, 0.0f, 0.0f, 0.0f); auto ui_camera = CreateCamera(world, PROJECTION_ORTHOGRAPHIC); ui_camera->SetPosition((float)framebuffer->size.x * 0.5f, (float)framebuffer->size.y * 0.5f, 0); ui_camera->SetRenderLayers(2); ui_camera->SetClearMode(CLEAR_DEPTH); auto pixmap = CreatePixmap(16, 8); for (int y = 0; y < 8; y++) { for (int x = 0; x < 16; x++) { pixmap->WritePixel(x, y, 0); } } while (window->KeyHit(KEY_ESCAPE) == false && window->Closed() == false) { while (PeekEvent()) { ui->ProcessEvent(WaitEvent()); } world->Update(); world->Render(framebuffer); } return 0; }
  10. A panel with a pixmap does not change colour or alpha. I've tried WIDGETCOLOR_BACKGROUND and WIDGETCOLOR_FORGROUND. #include "UltraEngine.h" #include "ComponentSystem.h" using namespace UltraEngine; int main(int argc, const char* argv[]) { auto displays = GetDisplays(); auto window = CreateWindow("Ultra Engine", 0, 0, 1440, 900, displays[0]); auto framebuffer = CreateFramebuffer(window); auto world = CreateWorld(); auto camera = CreateCamera(world); camera->Move(0, 2, -3); camera->SetClearColor(1, 0, 0); auto light = CreateDirectionalLight(world); light->SetRotation(35, 35, 35); auto floor = CreateBox(world, 100.0f, 0.5f, 100.0f); auto default_font = LoadFont("Fonts\\arial.ttf"); auto ui = CreateInterface(world, default_font, framebuffer->size); ui->SetRenderLayers(2); ui->root->SetColor(0.0f, 0.0f, 0.0f, 0.0f); auto ui_camera = CreateCamera(world, PROJECTION_ORTHOGRAPHIC); ui_camera->SetPosition((float)framebuffer->size.x * 0.5f, (float)framebuffer->size.y * 0.5f, 0); ui_camera->SetRenderLayers(2); ui_camera->SetClearMode(CLEAR_DEPTH); auto panel = CreatePanel(0, 0, 512, 512, ui->root); panel->SetPixmap(LoadPixmap("https://raw.githubusercontent.com/UltraEngine/Documentation/master/Assets/Materials/Ground/dirt01.dds")); panel->SetColor(1.0f, 0.0f, 1.0f, 0.5f); while (window->KeyHit(KEY_ESCAPE) == false && window->Closed() == false) { while (PeekEvent()) { ui->ProcessEvent(WaitEvent()); } world->Update(); world->Render(framebuffer); } return 0; }
  11. I checked it here as well. It's the actors collision method that is not being called. Josh are you able to take a look at this soon? 🙃 #ifdef DOUBLE_FLOAT void Actor::Collision(std::shared_ptr<Entity> collidedentity, const dVec3& position, const dVec3& normal, const dFloat speed, std::shared_ptr<Material> collidedmaterial) #else void Actor::Collision(std::shared_ptr<Entity> collidedentity, const Vec3& position, const Vec3& normal, const dFloat speed, std::shared_ptr<Material> collidedmaterial) #endif { ActorBase::Start(); auto actorbase = collidedentity->actor.lock(); std::shared_ptr<Actor> actor; if (actorbase) actor = actorbase->As<Actor>(); if (actor == NULL) actor = CreateActor(collidedentity); if (this->m_cameracontrols) this->m_cameracontrols->Collide(actor,position,normal,speed); if (this->m_collisioncallback) this->m_collisioncallback->Collide(actor,position,normal,speed); if (this->m_mover) this->m_mover->Collide(actor,position,normal,speed); }
  12. I just updated the download. It has a prefab and a map. There is still a few issues with it (cloud colour at night is red and there are no stars). Have a play with it and see what you can do. Hopefully shadmar makes a return one day to fix things up a bit.
  13. I'm having a play around with it now and am slowly fixing it again. I'll see what I can do!
  14. After working with kinematic joints I think a vector constraint would better suit my needs.
  15. Certain vectors cause the entity to scale rapidly down to zero on a few axis. Below is one example. #include "UltraEngine.h" #include "ComponentSystem.h" using namespace UltraEngine; int main(int argc, const char* argv[]) { auto displays = GetDisplays(); auto window = CreateWindow("Ultra Engine", 0, 0, 1440, 900, displays[0]); auto framebuffer = CreateFramebuffer(window); auto world = CreateWorld(); auto camera = CreateCamera(world); camera->Move(0, 1, -3); camera->SetClearColor(1, 0, 0); auto default_font = LoadFont("Fonts\\arial.ttf"); auto ui = CreateInterface(world, default_font, framebuffer->size); ui->SetRenderLayers(2); ui->root->SetColor(0.0f, 0.0f, 0.0f, 0.0f); auto ui_camera = CreateCamera(world, PROJECTION_ORTHOGRAPHIC); ui_camera->SetPosition((float)framebuffer->size.x * 0.5f, (float)framebuffer->size.y * 0.5f, 0); ui_camera->SetRenderLayers(2); ui_camera->SetClearMode(CLEAR_DEPTH); auto label = CreateLabel("", 10, 10, 500, 200, ui->root); auto light = CreateDirectionalLight(world); light->SetRotation(35, 35, 35); auto box = CreateBox(world); Vec3 up = Vec3(1.0f, 1.0f, 1.0f).Normalize(); while (window->KeyHit(KEY_ESCAPE) == false && window->Closed() == false) { box->AlignToVector(up, 1, 1.0f, 1.0f); auto scale = box->GetScale(); label->SetText("Scale : " + String(scale.x) + ", " + String(scale.y) + ", " + String(scale.z)); world->Update(); world->Render(framebuffer); } return 0; }
  16. I found some files scattered around my drives. I have no idea if this is everything or if it even still works. But in case no one else has anything better to give you this might get you started. DayNight.zip
  17. A small example. #include "UltraEngine.h" #include "ComponentSystem.h" using namespace UltraEngine; int main(int argc, const char* argv[]) { auto displays = GetDisplays(); auto window = CreateWindow("Ultra Engine", 0, 0, 1440, 900, displays[0]); auto framebuffer = CreateFramebuffer(window); auto world = CreateWorld(); auto camera = CreateCamera(world); camera->Move(0, 26, -3); camera->SetClearColor(1, 0, 0); auto light = CreateDirectionalLight(world); light->SetRotation(35, 35, 35); auto sphere = CreateSphere(world, 25.0f); auto box = CreateBox(world); box->SetMass(1.0f); box->SetPosition(-0.5f, 26.0f, 0.0f, true); while (window->KeyHit(KEY_ESCAPE) == false && window->Closed() == false) { world->Update(); world->Render(framebuffer); } return 0; }
  18. So it appears that just a sphere collider will create the above issues. Using a sphere mesh collider works best. There is no gap between the surface(other than the obvious gap as the surface curves) and the jitter is gone completely. auto sphere = CreateSphere(world, 25.0f); auto collider = CreateMeshCollider(sphere->lods[0]->meshes[0]); sphere->SetCollider(collider); @Josh does all this sound like a bug to you or is it just the way of sphere collisions?
  19. I increased the segments of the sphere and there is less of a gap. Still the same jitter though.
  20. Also it seems with sphere colliders the cubes are not actually colliding with the surface. For primitive shapes, such as cubes and spheres, is newton actually using the mesh to test collision? Or is it calculating the surface of the sphere with it's position and radius? That might explain why there is a gap.
  21. What could cause this? Could it be because the surface is a collidable sphere and it is curved too much for it to come to complete rest as a flat surface does? They are just cubes that fall onto a large sphere, nothing special. After a minute or two it stops in most cases.
  22. Same for the hinge joint too. It crashes if you try to delete it after at least one update & render.
  23. The cube randomly bounces about but the collide member is only set to true for the first collision. After that it fails to work. #include "UltraEngine.h" #include "ComponentSystem.h" using namespace UltraEngine; int main(int argc, const char* argv[]) { auto displays = GetDisplays(); auto window = CreateWindow("Ultra Engine", 0, 0, 1440, 900, displays[0]); auto framebuffer = CreateFramebuffer(window); auto world = CreateWorld(); auto camera = CreateCamera(world); camera->Move(0, 2, -3); camera->SetClearColor(1, 0, 0); auto light = CreateDirectionalLight(world); light->SetRotation(35, 35, 35); auto floor = CreateBox(world, 100.0f, 0.5f, 100.0f); auto default_font = LoadFont("Fonts\\arial.ttf"); auto ui = CreateInterface(world, default_font, framebuffer->size); ui->SetRenderLayers(2); ui->root->SetColor(0.0f, 0.0f, 0.0f, 0.0f); auto ui_camera = CreateCamera(world, PROJECTION_ORTHOGRAPHIC); ui_camera->SetPosition((float)framebuffer->size.x * 0.5f, (float)framebuffer->size.y * 0.5f, 0); ui_camera->SetRenderLayers(2); ui_camera->SetClearMode(CLEAR_DEPTH); auto label = CreateLabel("", 10, 10, 500, 200, ui->root); auto box = CreateBox(world); box->SetMass(1.0f); auto actor = CreateActor(box); auto c = actor->AddComponent<CollisionCallback>(); box->SetPosition(0.0f, 5.0f, 0.0f); auto last_time = Millisecs(); while (window->KeyHit(KEY_ESCAPE) == false && window->Closed() == false) { auto time = Millisecs(); while (PeekEvent()) { ui->ProcessEvent(WaitEvent()); } WString text = "Position : " + String(c->collided ? "True" : "False"); label->SetText(text); if (time > last_time + 2500) { c->collided = false; box->AddForce(0.0f, 300.0f, 0.0f); last_time = time; } world->Update(); world->Render(framebuffer); } return 0; } Component: #pragma once #include "UltraEngine.h" #include "../ComponentSystem.h" class CollisionCallback : public Component { private: public: bool collided = false, is_updating = false; int collision_count = 0; virtual void Update() { is_updating = true; } virtual void Collide(shared_ptr<Actor> collidedactor, const Vec3& position, const Vec3& normal, const dFloat speed) { collided = true; collision_count++; } };
×
×
  • Create New...