Giter Club home page Giter Club logo

qu3e's People

Contributors

dcousens avatar grodtron avatar kaadmy avatar kazade avatar noctisdark avatar orthographic-pedant avatar philck avatar randygaul avatar walasprime avatar wmcnamara avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

qu3e's Issues

Would qu3e be a good base for "distributed physics"?

A question, not a bug/feature request...

I'd like to make a sandbox/voxel-based/space-sim game. I'll be using UE4, and I'm buying as much pre-made assets as I can, as I'm no "game dev". UE4 has PhysiX built-in, but the one thing I wanted to achieve is that the game server is "fully distributed" (I'm in charge of "clustering" at work, so that's my "specialty" and my main interest), but I understand that getting PhysiX (or most physics engines) to work in "distributed mode" would be a giant undertaking. I have found someone doing that for PhysiX, but they are not sharing their code (yet). And the one or two commercial options are out of my financial reach.

My general strategy is breaking the universe into a large-scale 3D "grid", and each "grid cells" withc active entities (each maybe 1KM^3 in size) is allocated to a cluster node, such that nearby cells are on the same node. The entities in a node would then be broken up in "independent groups" (islands?), and each group would be assigned a thread (fixed-size thread pool), with each thread having one (or more?) separate "physics engine" instance.

The real problems come when too many entities are in a single thread/node, because they are all close enough to interact. My understanding is that at that point, you have break up the group and replicate the physics data over the cluster, such that each entity is managed by exaclty one physics engine instance, and acts like a "kinematic body" in the other instances where it can interacts.

Do you think qu3e is "hackable" enough, to be turned into a "distributed physics engine"? How would you go about it?

Demo does not compile on Windows

Windows 10 64bit
Visual Studio 2017 Enterprise

The demo subproject does not compile on Windows, since it requires the X11 library for freeglut. Possibly just a CMakeLists bug.

Reproduce steps:

  1. Open the VS developer console
  2. Clone the repo
  3. cmake .
  4. msbuild ALL_BUILD.vcxproj
  5. An error shows up that X11.lib cannot be found

Friction biases linear velocity towards axis directions

When friction is applied via both tangentVectors, the velocity approaches zero on one of the tangent vectors, resulting in the resultant velocity on that vector cancelling out before the global velocity.

This leads to an unexpected physical effect where a cube could be sliding diagonally across the XZ plane, then as friction is applied, it will bias towards either the X or Z direction and slide only on that axis - until stopping.

This can be observed in the demo's provided.

Is this intentional?

Initial velocity [1.2, 0, -1] (X bias)

\
 \
  \
   \___

Initial velocity [1, 0, -1.2] (Z bias)

\
 \
  \
   \
    |
    |

consider asni c99

since your goal is lightweight and simple ๏ผŒwhy not use c99 and combine into one single file ใ€‚i think that would be perfect

Installation manual

Hi bud! This tool is awesome, just what I've been looking for. But I spent a lot of time getting the demo to work. It'd be nice if you added a new entry in the readme explaining step by step the process of installation. Thanks!

Size of box

Is there a way to specify the width/height/depth of a q3BodyDef?

Add a release.

So I noticed you have a version number at the top of the README.md file that says this is version 1.01. Would you mind creating a release to match this? That way there's no confusion on which commit is actually version 1.01. It's also nice because there's a separate URL for downloading a source distribution from GitHub specifically for that release (as opposed to the latest master branch, for example). This URL could be hard-coded into package scripts for instance (whereas the master one could not).

Moving the time step in the scene constructor to the "Step" function

It's quite an inconvenience to have to specify it in the constructor rather than the Step function, especially if Step is not called on a seperate thread. Granted, you can use timers, but what if the user doesnt reach 60 fps or the specified time step?

It seems like a simple "fix" that ill probably contribute myself.

q3BroadPhase::InsertBox shouldn't call BufferMove for static bodies

Hi there
Thank you very much for sharing this project - its a great way to learn how physics simulations work!
Just a quick optimization suggestion - it appears that calling BufferMove in q3BroadPhase::InsertBox results in q3BroadPhase::UpdatePairs adding pairs where both sides belong to static bodies.
Maybe it would be a good idea to add an argument to q3BroadPhase::InsertBox that indicates if the box is moving and set it to false when the box belongs to a static body?

qu3e for a voxel engine?

Hi! I'm looking into using this as the physics engine for a Minecraft-like (voxel-based) game I'm making. It will run in Windows, Linux and Android. I just need something simple that can simulate non-rotating AABB entities, and this looks perfect, but for terrain collision I would need to make triangle meshes... My main question is, can I instead just create a bunch of physical boxes for the exposed blocks without losing lots of performance (memory and CPU-wise)? Additionally, I need to do raycasting and get the world location and normal vector of the box face that has been hit...

And now, about the planned features, it would be nice to have springs to make fun stuff! Multithreading would be great for performance, too. I'm even willing to help developing those features, but I know almost nothing about physics. I could do my research, though.

C API?

Any chance of getting one for this library? I'm using another language and can only interface with C.

Scene creates lots of object spontaniously for unknown reason

Hello,
I'm trying to use q3 but it doesn't seems to work for me quite as I expected. I'm creating simpliest test scene with 3 static objects(floor and 2 walls, each containing only 1 box ) and 1 dynamic object(supposed to be player, contain only 1 box too).
But when I run it, there is suddenly another object on the scene! Which starts to multiply as soon as I move the player object(I do suspect that it is spawns directly from player object). Anyway, soon I'm getting debug view with hundreds of objects that I never created.
It looks like this: http://imgur.com/a/lM6Ya
It seems like I'm doing something very wrong but I can't figure it out since I mostly just copypasted demo code. Maybe it is becouse I use SetLinearVelocity to move player?
(I didn't get to look deep into q3 source yet, sorry)

VS 2013 stack overflow

Compiling on Visual Studio 2013. Program compiles 64-bit, but fails at the start of main with the following code:

#include "q3.h"

int main()
{
    q3Scene scene(1.0 / 60.0);
}

"Unhandled exception at 0x00007FF70F992E27 in program.exe: 0xC00000FD: Stack overflow (parameters: 0x0000000000000001, 0x0000003329403000)."

Potential bug in q3Body::RemoveBox

My compiler gives me an unused variable warning (list) at this section of code:

    q3Box* node = m_boxes;
    q3Box* list = m_boxes;

    bool found = false;
    if ( node == box )
    {
        list = node->next;
        found = true;
    }

Indeed, the list variable is assigned to, but never used. It seems to me that in this particular case (where the head of the m_boxes list is the box to be removed) m_boxes isn't updated to point to node->next. I'm not convinced I've fully groked the code yet though, I just saw this in passing.

Mass

This might seem like a silly question but I can't see how you should set the mass of an object?

Setting up a simple scene, a box that falls with gravity. I ended up making m_mass a public member and it works as expected, but I guess thats not correct way of doing it.

This project is still alive?

Hi, I found this project after some searches and I think a cool project and simple code, perfect to me and my future 3d game.
I'm thinking about port it to typescript just for my game. I don't want to use webassembly.
So, it still is kept? Is it still alive?
My idea is to sync this project with my port all time have some bug fix.

Questions

Hello, sorry to ask questions in an issue! I've been going through the source and demos trying to puts some info together, but can't judge the suitability. Fundentally I'm making a fairly simple first person game. How I did it in bullet was cast a ray down till it hit the ground. and would use a ghost box, this would tell me the overlap of colliding entities and would step back till these overlapps had been resolved.

The issue looks easy enough, but the ghost box I'm not so sure on. Looks like I can make a box a sensor, but unsure if that will give me enough information to be able to resovle the collision.

Or would there be a better way todo a first person game with qu3e.

Fails to compile on OS X

Hi there!

qu3e fails to compile on my version of OS X (latest as of this writing: 10.10.3) with the following error:

/path/to/project/qu3e/src/broadphase/../common/q3Memory.h:30:10: fatal error: 'malloc.h' file not found

This (and one other error) can be fixed by removing the #include <malloc.h> from q3Memory.h and q3Scene.cpp. Obviously, simply deleting these lines doesn't seem like a very cross-platform solution, but I'm not skilled enough at cross-platform compilation to give a proper pull request to address this.

I imagine something along the lines of this in each of the files?

#ifndef __APPLE__
#include <malloc.h>
#endif

Though there's probably a better way via defining a "NEEDS_MALLOC" variable through CMake. And there, I'm completely out of my element. ๐Ÿ˜„

Sliding boxes "catch" on edges in floor

Hello! First of all, thank you for this library, I've been using it in my own voxel game, and it has been worked great! However, I've been stuck on this problem and I'm not really sure how to approach it.

Basically, the problem is that because this is a voxel game, the floor is made up of a bunch of different boxes. When objects slide on top of the floor, sometimes they will catch on a seam between two boxes and stop suddenly. I think this is happening because the object sliding on top is slightly protruding into the floor, and this part collides with the sides of the boxes in the floor.

Do you have any ideas to solve this? I tried changing the collision detection to ignore collisions on the very edge of boxes, but it's been hard to do this without ignoring actual collisions. Any help is appreciated!

Thanks!

Arch Linux compilation errors

When compiling on latest Arch Linux 64-bit, I get numerous errors regarding the FILE type being nonexistent, due to not including stdio.h in several files.

Another issue while linking freeglut (why is freeglut bundled?) is undefined reference to symbol 'XPending'

assert (axis != 0)

I was wondering what triggers this crash on programs using this library. I'm not sure if this is how I should use the issues section but I just wanted to ask.

How could I implement a vertically-sliding door?

Not really an issue, but I couldn't find a better place to ask about this. ๐Ÿ˜…

I'd like to implement a sliding door: in short, it should behave like a static body, but I'd like to be able to animate its position (either vertically or horizontally). Could you share any quick pointers to the right approach with qu3e? I'm evaluating possible candidates for my game physics and I'd like to get a better idea before getting into code.

I love how simple and lightweight qu3e is, great job!

How can I read the XYZ euler angles from a q3Mat3?

I am having a bit of trouble extracting the XYZ euler angles from a 3x3 rotation matrix. I have this code that updates the position based on the transform given from the GetTransform() function.

const q3Transform& tr = body->GetTransform();
m_transform.SetPosition(tr.position)

I want to be able to set a rotation aswell, but I am not sure how to extract euler angles from the rotation matrix in the transform variable.

How would I go about getting euler angles from a rotation q3Mat3?

wrong comments

In file "q3Memory"
I think the right comment should be "Remove the prevBlock from the freeBlocks array"

// Remove the nextBlock from the freeBlocks array
assert( m_freeBlockCount );
assert( prevBlockIndex != ~0 );
--m_freeBlockCount;
m_freeBlocks[ prevBlockIndex ] = m_freeBlocks[ m_freeBlockCount ];

q3Scene.Step is freezing

dump_7.txt

I have a scene with 13 bodies. 12 of them are different types of walls and 1 is the dynamic player body. You can shoot projectiles which are also dynamic bodies. Everything usually works fine except for when I shoot right into the space where 2 walls touch. The whole app just stops and freezes, windows shows the whole 'not responding thing' but it doesn't crash, almost as if it were going into an infinite while loop. I set some breakpoints to see what was happening - still don't really see the problem but execution goes into q3Scene.Step() and never comes out. I assume there's a problem in there somewhere, or maybe I didn't set up my bodies correctly. I've attached a dump of the scene just before the freeze. Any help would be greatly appreciated - I've been struggling with this for hours and I'm not a physics engine person so it's pretty hard to wrap my head around this. Thanks.

Is it possible to set up without ImGUI?

Can a small demo be provided in pure free glut or glfw or something? like just pressing a key to add a cube to the scene. In theory it should be simple, but I can't figure it out.

Consider triangle mesh support

Hi!

First of all, let me thank you for such an awesome library. I've been looking for a lightweight (and portable) physics library for a while and after spending a day failing to get yocto-gl to work as I needed, Qu3e did what I wanted immediately! So, massive thanks!

Now on to the reason I'm creating an issue. I've read in your readme that you are considering sphere and capsule support, but not necessarily convex hulls and meshes. I just thought I'd let you know that support for triangle meshes (like those used for terrains in games) would be much appreciated. For the time-being I'm writing my own ray-casting code to deal with things moving over a terrain, but if Qu3e supported this kind of mesh as well as OBBs that would be amazing.

I would attempt this myself, but my algebra lets me down. If such a feature were to implemented, do you have any suggestions or thoughts on what approach would be most suitable?

Thanks again!

Crash With Tree Balance.

After a few hours play of automated play I get a bad access crash in q3DynamicAABBTree::Balance

i32 iB = A->left; // Has value 339247232
i32 iC = A->right; // Has value 292
Node *B = m_nodes + iB;
Node *C = m_nodes + iC;

i32 balance = C->height - B->height;

On OSX but don't think that makes a difference here. The game / physics are quite solid, although I do somtimes get tunnleling, although that is likely due to framerate of debug build not being as it should, rather than anything.

Update
Happens on Windows, trying to confirm its not me doing something dumb, right now.

linker errors?

Sorry for sounding so noobish, but I included q3.h but getting 3 linker errors about q3Vec3. I'm assuming it's the q3Vec3.inl (inline file) but am I supposed to include that on my main.cpp as well?

A simple box stack is not stable without sleeping

Hey Randy,

First off, thanks for the code. It's a great learning tool. There's something I wanted to bring to your attention and understand whether it's expected. To reproduce:

  1. Clone the latest version of the repo.
  2. In Demo.cpp, change bool enableSleep = true; to bool enableSleep = false;
  3. In BoxStack.h, change the code that adds the boxes so that it adds a single stack of 5:
for ( i32 i = 0; i < 5; ++i )
{
		        r32 k = 0;
		        r32 j = 0;
			bodyDef.position.Set(  1.0f * j, 1.0f * i + 1.0f,+ 1.0f * k );
			body = scene.CreateBody( bodyDef );
			body->AddBox( boxDef );
}
  1. Run the BoxStack demo.

After a few seconds (~5), the box stack collapses. This is without changing anything else and just by disabling sleep. Is this expected? I'd expect a warm-starting solver to be able to resolve a box of 5 boxes, especially at the default 20 iterations, without needing to put the boxes to sleep.

I'd love any insight!

About the unfinished features

Hi, and thanks for this lovely tool! Have tested it and it's very nice. However, I couldn't help but notice
on the readme that these two features are cited to not be yet completed:

3D Raycasting into the world *
Ability to query the world with AABBs and points *

In what manner are they not finished? I'm kinda curious.

Thanks again!
Colin

Questions about naming

Is there any specific reason float/double are typedef'd as r32/r64 respectively?
C99/C++11 should have fixed size int/uints already defined in stdint, why are custom types defined?

Would it be cleaner to have the one-time compile locks on the headers be renamed to start with an underscore, for example rename Q3TYPES_H to _Q3TYPES_H?

Is memory management needed?

If I create a body with scene.CreateBody(), it returns a pointer to a q3Body. When I am done with the body, do I need to free it by calling delete or will qu3e do that automatically? A small overview of which kinds of things I need to delete myself and which are freed automatically would be good. Thanks.

I dont understand rotating boxes

Iv'e spent a couple days trying to figure out how to rotate something on the Y axis with qu3e, however I don't understand why there is an axis and an angle parameter, and why the transform is a mat3 instead of a vec3.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.