Jump to content

SpiderPig

Members
  • Posts

    2,306
  • Joined

  • Last visited

Everything posted by SpiderPig

  1. Run this example and you will see that the capsule collider goes through the floor before it collides. May need to enable wireframe after it collides to see that it's below the floor. #include "Engine.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 framebuffer auto framebuffer = CreateFramebuffer(window); //Create a world auto world = CreateWorld(); //Create a camera auto camera = CreateCamera(world); camera->SetClearColor(0.125); camera->SetPosition(0, 2, -6); camera->SetDebugPhysicsMode(true); //Create light auto light = CreateDirectionalLight(world); light->SetRotation(35, 35, 0); light->SetColor(3); auto floor = CreateBox(world, 100.0f, 0.1f, 100.0f); auto box = CreateCylinder(world, 0.5f, 1.8f); box->SetMass(1.0f); box->SetPosition(0, 4, 0); box->SetCollider(CreateCapsuleCollider(0.5f, 1.8f)); //Main loop while (window->Closed() == false and window->KeyDown(KEY_ESCAPE) == false) { world->Update(); world->Render(framebuffer); } return 0; }
  2. I believe we need a setter and getter for the pin, like for the plane joint. Other wise the only way to change this is to delete and reconstruct the plane joint. Joint::SetPin() Joint::GetPin()
  3. I was playing around with sliders and couldn't get the child object to collider with it's parent. This example here is the same. The green cube floats straight through the blue cube. At first I thought it was because the parent had no mass. But in my project, even if both child and parent have mass there is no collision between them. https://www.ultraengine.com/learn/CreateSliderJoint?lang=cpp
  4. This might do what I need. http://www.newtondynamics.com/wiki/index.php/NewtonConstraintCreateUserJoint I think we need a joint in Ultra that allows us to parent a physics object to anther physics object and still have everything work.
  5. I don't know if such a joint exists, but what I need is something that will allow me to spin a planet around with a kinematic joint and have all physics objects on the surface of that planet not move. In the video here gravity goes to the centre of the sphere. You can see once the small spheres come to a rest I start to spin the large sphere with the kinematic joint and the spheres on the surface begin to rotate. I understand that this is probably the correct behavior due to inertia and what not but I want to turn it off! I need a joint that I can use to parent lots of objects to one main physics object, that regardless of how I move that larger object the child physics objects will be constrained to it - but still react to physics! Pretty much being able to use Entity::SetParent() but not breaking physics, and having physics being able to run in local space to the parent. Is this something newton can do? I might post in the forums on Newton as well.
  6. SpiderPig

    Where will you go?

    That looks amazing 😍
  7. When accessing UltraEngine.com via mobile there is no where to log in. I had to go through the learn docs to find a link that took me to a sign up page. There I found a sign in link but there's nothing on the main page. Once signed in there's also no apparent way to access your messages.
  8. Pretty sure I got it working. I'll test it a bit more before bringing in the game though. There is a switch statement for the change in the UP vector. Depending on what axis is UP currently to what axis is the target UP direction dictates what the rotation matrix should be for both the forward and side vectors. Should work for a round planet too.
  9. Yeah I think that's exactly what I need to do. Should be easier than writing out a 1000 line switch statement.
  10. Gravity is going to the centre of the cube and I do use Slerp(). The problem is what the video shows. Going over a some edges will cause the player to rotate about its local y axis 90 degrees. I think even if I used AlignToVector() and was walking on a sphere it would do the same thing.
  11. After toying with aligning to vectors it seems that one simple align to vector function will not be suited for all use cases. It's fine for one use alignment, like at game start, but not good for animating a vector that can go through 360 degree rotation on all axis in real-time. There are certain situations where in order to get a good result the object that's being aligned to the vector must rotate by changing it's forward axis. Which is what the video above was showing. I think I've found a solution for this. Although at the moment it is rather convoluted. It involves writing 216 switch statements (scream) that takes the desired up direction axis, the current forward axis, and the current sideways axis and spitting out the new forward and side vectors that will ensure the transition to a new up vector will be smooth. The camera never rotates 90 degrees to a new forward direction. So far it's very smooth and after few more days (years) I'll have it finished and will show the (hopefully good) result. At the moment it only works if walking over the edge of a cube but I'm near certain I can modify it slightly to walk all around a spherical object.
  12. Oh okay, I thought maybe both did the exact same thing. How would I align a matrix to a vector?
  13. Thankyou. But should this code give two different results? auto m = Mat4(); m.MakeDir(Vec3(0.0f, 0.0f, 1.0f), 1); Print("Mat4"); Print(WString(m[0])); Print(WString(m[1])); Print(WString(m[2])); Print(WString(m[3])); Print("Quat"); auto q = m.GetQuaternion(); Print(WString(q)); Print("Euler"); auto r = q.Euler(); Print(WString(r)); Print(""); Print("--------------------------------------------------------------"); Print(""); auto up_pivot = CreatePivot(nullptr); up_pivot->AlignToVector(Vec3(0.0f, 0.0f, 1.0f), 1); m = up_pivot->GetMatrix(); Print("Mat4"); Print(WString(m[0])); Print(WString(m[1])); Print(WString(m[2])); Print(WString(m[3])); Print("Quat"); q = m.GetQuaternion(); Print(WString(q)); Print("Euler"); r = q.Euler(); Print(WString(r)); Console Output. Mat4 1, -0, -0, 0 0, 0, 1, 0 0, 1, 0, 0 0, 0, 0, 1 Quat -0, -0, 0, 0.707107 Euler 0, -0, -0 -------------------------------------------------------------- Mat4 0, 1, -0, 0 0, 0, 1, 0 1, -0, -0, 0 0, 0, 0, 1 Quat -0.5, -0.5, -0.5, 0.5 Euler -0, 90, 90
  14. I'm not positive I'm using it right... but no matter what I do the matrix's rotation (r) is always zero. Where as (i) is correct - Vec3(0,90,90); MakeDir() returns nothing, I checked. auto m = Mat4(); m.MakeDir(Vec3(0,0,1), 1); up_pivot->AlignToVector(Vec3(0,0,1), 1); auto i = up_pivot->GetRotation(); auto r = m.GetRotation();
  15. I'm using this code to align a pivot to the up direction of my player controller. up_pivot->AlignToVector(up_direction, 1); target_quat = target_quat.Slerp(up_pivot->GetQuaternion(), 0.1f); kinematic_joint->SetPose(pos, target_quat); The video below shows it working really well when the forward direction is along the X axis (red arrow in the distance). However when moving back and forth along the z axis player spins 90 degrees to face the (+) X axis when the up vector is something like Vec3(0.0f, 0.0f, 1.0f) or Vec3(0.0f, 0.0f, -1.0f). You can see it at around 25 seconds into the video. I know this is a by product of aligning to a vector, but what I'm wondering is - is there is a way to align to an up vector as well as a forward vector? This way I think my player rotation can be more controlled when the up direction changes as I can track both up and forward vectors with ease. Matrix math perhaps?
  16. You mean like a render hook that displayed the inventory when the capture was ready for the inventory shader to use?
  17. Not really, I want to capture a screen shot before I open my inventory and then use that result as a background for my inventory that will be blurred. Like the window transparent effect in the editor. It won't be real time but that's fine. I'm just worried about spending the time waiting for the capture to be ready as a pixmap and then going through all the conversion and re-upload to the GPU when it's already there.
  18. If I capture a screenshot with framebuffer->Capture(), is there a way I get the result within a shader without first getting it as a pixmap, then converting it to a texture, then giving it to a material? if (window->KeyHit(KEY_SPACE)) framebuffer->Capture(); auto caps = framebuffer->GetCaptures(); for (auto pixmap : caps) { auto path = GetPath(PATH_DESKTOP) + "/screenshot.jpg"; pixmap->Save(path); RunFile(path); } Maybe something like this might be possible? FRAGMENT SHADER if (capture_result_handle != -1){ vec4 capture_color = texture(capture_result_handle, frag_coords) }
  19. I'm not using the default widget system here, I've made my own and rasterize my fonts to a texture. In this screenshot you can clearly see the problem I have. I added a background shader to the font shader. The text only looks good when on dark backgrounds. You can see the right side is much nicer than the left side. Here's my inventory. I'm unsure if this is a font shader issue - a rasterization issue - or simply I need better font colours depending on the background color. Thought I'd ask to see if any one here might have any tips.
  20. So it is. Thanks. It's not in the docs by the way.
  21. That would be good. Something like Texture::RemoveMipMap() maybe? Would also be cool if you didn't have to restart the game for it to take effect. You would probably need access to a list of materials to loop through... maybe. Or maybe the user should add there materials to their own list so they can identify what textures should be changed and what shouldn't be.
  22. SetFileTime() would be nice to have. I want to be able to convert a file to DDS and then set the DDS file to the creation date / time of the source file. That way when I run my converter again it won't re-convert the source file unless it is newer than the already existing converted DDS file.
  23. How do games mange the texture resolution that's used in game? In the options menu you sometimes have the ability to change the texture detail from Low to High. I guess all it's doing is using a different resolution per setting. For example; LOW 512x512 MEDIUM 1024x1024 HIGH 2048x2048 ULTRA 4096x4096 I'm wondering if it's possible for everything to have 4K textures, but maybe on game load / restart you could remove the higher resolution mip-maps via code depending on the setting? Surely they can't have 4 copies of each texture, that'd be an insane hard drive guzzler.
×
×
  • Create New...