Jump to content

reepblue

Developers
  • Posts

    2,470
  • Joined

  • Last visited

Everything posted by reepblue

  1. If you edit the FirstPersonControls component to with the below, then create a prefab using it, the mouse look will be sluggish. I've spent 4 hours last night trying to figure this out and I can confirm this is a bug with the prefab system. If you were to assign this to an entity normally, it'll work fine. The Raw mouse code tends to work ok regardless. #pragma once #include "UltraEngine.h" #include "FirstPersonControls.h" using namespace UltraEngine; FirstPersonControls::FirstPersonControls() { name = "FirstPersonControls"; } void FirstPersonControls::Start() { auto entity = GetEntity(); entity->SetPhysicsMode(PHYSICS_PLAYER); if (entity->GetMass() == 0.0f) entity->SetMass(78); entity->SetCollisionType(COLLISION_PLAYER); camera = CreateCamera(entity->GetWorld()); camera->SetPosition(0, eyeheight, 0); camera->SetRotation(0, 0, 0); camera->SetFov(70); currentcameraposition = camera->GetPosition(true); freelookrotation = entity->GetRotation(true); } void FirstPersonControls::Update() { Vec3 movement; float jump = 0; bool crouch = false; auto entity = GetEntity(); auto window = ActiveWindow(); if (window) { auto cx = Round((float)window->GetFramebuffer()->GetSize().x / 2); auto cy = Round((float)window->GetFramebuffer()->GetSize().y / 2); auto mpos = window->GetMousePosition(); window->SetMousePosition(cx, cy); auto centerpos = window->GetMousePosition(); if (freelookstarted) { float looksmoothing = mousesmoothing; //0.5f; float lookspeed = mouselookspeed / 10.0f; if (looksmoothing > 0.00f) { mpos.x = mpos.x * looksmoothing + freelookmousepos.x * (1 - looksmoothing); mpos.y = mpos.y * looksmoothing + freelookmousepos.y * (1 - looksmoothing); } auto dx = (mpos.x - centerpos.x) * lookspeed; auto dy = (mpos.y - centerpos.y) * lookspeed; freelookrotation.x = freelookrotation.x + dy; freelookrotation.y = freelookrotation.y + dx; camera->SetRotation(freelookrotation, true); freelookmousepos = Vec3(mpos.x, mpos.y); } else { freelookstarted = true; freelookrotation = camera->GetRotation(true); freelookmousepos = Vec3(window->GetMousePosition().x, window->GetMousePosition().y); } float speed = movespeed;// / 60.0f; bool jumpkey = window->KeyHit(KEY_SPACE); if (entity->GetAirborne()) { speed *= 0.25f; } else { if (window->KeyDown(KEY_SHIFT)) { speed *= 2.0f; } else if (window->KeyDown(KEY_CONTROL)) { speed *= 0.5f; } if (jumpkey) { jump = jumpforce; } } if (window->KeyDown(KEY_D)) movement.x += speed; if (window->KeyDown(KEY_A)) movement.x -= speed; if (window->KeyDown(KEY_W)) movement.z += speed; if (window->KeyDown(KEY_S)) movement.z -= speed; if (movement.x != 0.0f and movement.z != 0.0f) movement *= 0.707f; if (jump != 0.0f) { movement.x *= jumplunge; if (movement.z > 0.0f) movement.z *= jumplunge; } crouch = window->KeyDown(KEY_CONTROL); } entity->SetInput(camera->rotation.y, movement.z, movement.x, jump, crouch); float eye = eyeheight; float y = TransformPoint(currentcameraposition, nullptr, entity).y; float h = eye; if (y < eye) h = Mix(y, eye, 0.5f); currentcameraposition = TransformPoint(0, h, 0, entity, nullptr); camera->SetPosition(currentcameraposition, true); } //This method will work with simple components shared_ptr<Component> FirstPersonControls::Copy() { return std::make_shared<FirstPersonControls>(*this); } bool FirstPersonControls::Load(table& properties, shared_ptr<Stream> binstream, shared_ptr<Map> scene, const LoadFlags flags) { if (properties["mousesmoothing"].is_number()) mousesmoothing = properties["mousesmoothing"]; if (properties["mouselookspeed"].is_number()) mouselookspeed = properties["mouselookspeed"]; if (properties["movespeed"].is_number()) movespeed = properties["movespeed"]; return true; } bool FirstPersonControls::Save(table& properties, shared_ptr<Stream> binstream, shared_ptr<Map> scene, const SaveFlags flags) { properties["mousesmoothing"] = mousesmoothing; properties["mouselookspeed"] = mouselookspeed; properties["movespeed"] = movespeed; return true; } testplayer.zip
  2. Two things: 1. When creating a camera at the world's position (0,0,0) the entity will exist in the world but will not show up in the editor. 2. The map will break and will be unrecoverable as the camera when a prefab includes a camera. The camera/prefab is no longer listed in the entity so you can't just delete it. 3. Also it seems that the camera can't be the first object to be made. You need another point entity in the scene first. camprefab.zip
  3. No, it sees them, it's just being treated as files and not directories.
  4. Super! I'll definitely try this and report back to you. This should be very helpful.
  5. If you can start with a simple .collider export extension for blender, I'm sure people would appreciate it!
  6. I complained about this many times in our Workshops but yeah this looks disgusting. What's your lighting setting with this by the way?
  7. One thing I was trying to do was zip up files by extension and use raw asset timestamps to check if any of the files are newer than the previously made packages. My application didn't work 100% but I think this was before ZipLib was introduced as part of the engine (?) I'm not sure, it's been a while since I tried to make my own tools.
  8. I think this is really useful despite the UI being a bit overwhelming at first. Some bugs here and there but I see it's potential. Here are my suggestions/ideas: I would remove Steamworks altogether. People probably aren't going to feel good about putting their Steam information into a 3rd party app. Your packager doesn't do what I expected. I expected it to at least act like the Leadwerks publisher by zipping the game content and pasting the package into a new folder along with the executable and the dlls. Also, using separate folders doesn't seem to work. If possible, I recommend you rebuild the application using the engine library. It has ZipLib included, and your application can be multiplatform. I'm taking you wrote this in C# or some other .NET framework.
  9. I've wondered why my models would magically go dark all of a sudden. Thanks.
  10. @Josh This is broken again with the last update, please remove the solution tag.
  11. I can confirm that my window resizing/rebuilding code works as expected.
  12. Yeah, from my application, it seems that the active window isn't being reassigned. The text should be in the bottom corner of this window but it's in the position of the bottom right of my splash window.
  13. I'm also running into an issue with my window resizing code.
  14. I've encountered in my project issues regarding the interface class when used in 3D. 1. This example looks broken. 2. My console is broken and I can no longer show/hide the camera projecting the UI. Please refer to the codebase I sent you on February 17th to better debug this problem and more.
  15. This event no longer gets emitted when the renderer has started. I use this event to hide my splash window and then show the game window. Put a break on the Print call and you'll notice it'll not get triggered. #include "UltraEngine.h" using namespace UltraEngine; int main(int argc, const char* argv[]) { //Get the displays auto displays = GetDisplays(); //Create a window auto window = CreateWindow("Ultra Engine", 0, 0, 1280, 720, displays[0], WINDOW_CENTER | WINDOW_TITLEBAR); //Create a world auto world = CreateWorld(); //Create a framebuffer auto framebuffer = CreateFramebuffer(window); //Create a camera auto camera = CreateCamera(world); camera->SetClearColor(0.125); //Main loop while (window->Closed() == false and window->KeyDown(KEY_ESCAPE) == false) { while (PeekEvent()) { const auto e = WaitEvent(); if (e.id == EVENT_STARTRENDERER) { Print("Renderer has started with code: " + String(e.data)); } } world->Update(); world->Render(framebuffer); } return 0; }
  16. Shaders families are now .fam files.
  17. Yeah, this keeps breaking. This is like the 3rd time now. I'll test this on my end when I get the chance.
  18. Hello, I am making some files that I wish to be treated as an asset, but I don't know how to properly initiate it as such. There is commented code in the Asset.h header but when I tried to intergrate that code into my CreateMyAsset() function, I couldn't cache the asset. I'd like an example of how I would Initiate a new asset.
  19. You can, But why would you? Honestly, I think 2D games are best targeting the cheapest hardware you can find and making something cool with SDL2 or something. Ultra Engine is ment for high performance games and applications.
  20. Pay the fee, get the appid. Having a repo on Steam allows for easy private testing and you can get started on integrating some Steamworks features. Some features like Leaderboards, Stats, and (surprisingly) Steam Input will not work until your Store page is live. I was in your position when it came to Cyclone but people encouraged me to put it on Steam because they want all their games on one place. Stay away from EGS, they are criminals, lol.
  21. This extension will convert a material to DDS. Right-click on an image file in the asset browser, select the "Convert Textures to DDS" menu item, and the file will be created with the correct compression based on the type. ConvertImageToDDS.lua
  22. I've noticed this issue too. Compiling the application not as a console application usually solves the issue.
  23. I was actually using the drop down menu for material under appearance like you would in Leadwerks. I didn't know you could drag and drop the material to a sprite. If you do use the dropdown, the material will not apply nor save it's selection. I think the solution would be to remove it and have only one way of assigning materials to objects by drag and drop.
  24. The selected image also doesn't save after deselecting the entity.
×
×
  • Create New...