Git Product home page Git Product logo

qu3e's Introduction

qu3e v1.01

qu3e is a compact, light-weight and fast 3D physics engine in C++. It is has been specifically created to be used in games. It is portable with no external dependencies other than various standard c header files (such as cassert and cmath). qu3e is designed to have an extremely simple interface for creating and manipulating rigid bodies.

qu3e is of particular interest to those in need of a fast and simple 3D physics engine, without spending too much time learning about how the whole engine works. In order to keep things very simple and friendly for new users, only box collision is supported. No other shapes are supported (capsules and spheres may be added in the future if requested).

Since qu3e is written in C++ is intended for users familiar with C++. The inner-code of qu3e has quite a few comments and is a great place for users to learn the workings of a 3D physics engine.

qu3e stands for "cube", since the 3 looks slightly like the letter b and boxes (or cubes!) are the primary type of collision object.

Screenshots

screenshot 1 screenshot 2 screenshot 2 screenshot 3 screenshot 4

Feature List

Since the primary goal of qu3e is simplicity of use the feature list is inentionally kept to a minimum. If a more full-featured open source physics engine is required I recommend the Bullet physics library:

  • Extremely simple and friendly to use API
  • 3D Oriented Bounding Box (OBB) collision detection and resolution
  • Discrete collision detection
  • 3D Raycasting into the world (see RayPush.h in the demo for example usage)
  • Ability to query the world with AABBs and points
  • Callbacks for collision events
  • Sensors (collision volumes)
  • Ability to create an aggregate rigid body composed of any number of boxes
  • Box stacking
  • Islanding and sleeping for CPU optimization
  • Renderer agnostic debug drawing interface
  • Dynamic AABB tree broad phase
  • Highly accurate collision manifold generation via the Separating Axis Theorem
  • Collision layers
  • Axis of rotation locking (x, y or z axes)
  • Modifiable q3Alloc and q3Free functions for custom memory allocation
  • Internal heaps and dynamic arrays for memory management, uses q3Alloc/q3Free
  • Scene dump -- Can output a log file of C++ code to re-create a physics scene

Using qu3e

Using qu3e is about creating rigid bodies and attaching boxes to them. When a rigid body is initially created it exists without any collision information. Any number of shapes can be attached to a rigid body. All shapes are defined relative to their owning rigid body, or in other words: all shapes are defined in model space, where model space is the reference frame of the parent rigid body.

The only header that should need to be included is q3.h. First create a physics scene. Usually only one physics scene needs to ever be created. The user must specify a fixed timestep upon scene creation:

#include "q3.h"

q3Scene scene( 1.0 / 60.0 );

A rigid body is created from a physics scene, and rigid bodies (or shapes) cannot be shared between different scenes. Rigid bodies are created by first creating a q3BodyDef object. Def objects can be created right on the stack:

q3BodyDef bodyDef;
q3Body* body = scene.CreateBody( bodyDef );

The q3BodyDef can be passed to a scene in return for a new rigid body. The body definition lets the user specify many settings. See q3Body.h for details. Once a rigid body is constructed any number of boxes can be added to it by providing the body with a q3BoxDef:

q3BoxDef boxDef; // See q3Box.h for settings details
q3Transform localSpace; // Contains position and orientation, see q3Transform.h for details
q3Identity( localSpace ); // Specify the origin, and identity orientation

// Create a box at the origin with width, height, depth = (1.0, 1.0, 1.0)
// and add it to a rigid body. The transform is defined relative to the owning body
boxDef.Set( localSpace, q3Vec3( 1.0, 1.0, 1.0 ) );
body->AddBox( boxDef );

To simulate the scene simply call scene.Step( ). This will simulate the world forward in time by the timestep specified at the scene's construction (usually 1/60 or 1/30).

Reporting Bugs

I've found a bug. How should I report it, or can I fix it myself?

If you feel up for fixing bugs please do add a pull request and I'll do my best to look over and merge the request. Otherwise the github "issues" facility is great for reporting and discussing bugs.

Use the q3Scene::Dump( FILE* ) feature, if possible.

qu3e has a cool feature that Box2D employs: the scene can dump C++ code into a text file. This code can be directly copy/pasted into one of my own demo files. If anyone has a specific bug and is able to dump the scene just before the bug occurs, a scene file can be shared -- this allows a very easy way for myself (or others) to pinpoint and remove bugs. The scene dumping tool is also just a good way to share scene initialization in general. Note: Since the dump outputs C++ code the dump itself is not a form of proper serialization as a recompile would be necessary to run the dump's contents.

FAQ

Can you add in this feature?

One of the main goals is to keep the feature list low in order to control code bloat, complexity, and the API itself. If a more full-featured open source physics library is desired please see the Bullet physics engine. That said I'm always open to new ideas. Please use the github "issues" facility to suggest or discuss improvements -- I'll happily respond as time permits.

What are the pros and cons of using your library over something like Bullet, Havok or ODE?

As far as I'm aware there aren't any simple and fast open source modern 3D physics engines. Hopefully qu3e can fill in this type of role with pros such as: small library, easily ported to other languages, free, consistent implementation style, minimal to no dependencies. The only cons of qu3e over other engines would be small feature list, but whether this is a significant con depends on the needs of the user.

Why don't you use this (insert C++ feature/library/tool) within your code?

Making use of various C++ features or external C++ libraries adds to the dependencies of the whole project. The idea is that if simple C-like code is pervasive then porting to other languages becomes simple. Just because a feature exists does not warrant its use.

What collision shapes are supported?

Currently just boxes (width, height, depth). Spheres and capsules may be added in the future depending on if users request them. Currently any number of boxes can be used to construct an aggregate rigid body -- this assuages most collision desires that many users have. Perhaps convex hulls and meshes will be added in the far future.

Future

As time goes on the feature list of qu3e will intentionally not grow much larger (at least for the near future). Since the primary goal of the library is to very simple in terms of implementation, and simple to use, bloat should be avoided. However, if anyone wants to contribute to any of these areas I would be more than happy work with contributors to include their contributions to qu3e. I handle contributions on a case-by-case basis, and full credit to the contributor would be granted in the source code comments, and in this readme.

Baumgarte and Post Stabilization (Full Non-linear Gauss Seidel)

Currently qu3e uses the Baumgarte Stabilization method for ensuring that "constraint drift" does not occur. The Baumgarte method is very efficient and simple to implement, thus qu3e uses it. However the Baumgarte method does not look all too pleasant in many cases, and also adds extra energy into the system. This is why qu3e has trouble simulating zero restitution.

A much better stabilization method would be Post Stabilization. The idea here is to use the velocity jacobian from the velocity constraint to form an iterative position level solver. A good discussion of various stabilization techniques (including the preferred method talked about in this paragraph) can be found in Box2D's b2Island.cpp file in the comments near the top. To implement proper Post Stabilization would require a fair amount of refactoring of the collision detection in qu3e. Right now qu3e constructs collision manifolds in world space. If these were changed to store information relative to the shapes associated with a manifold, then it would be much easier to implement post stabilization. Some other changes would be necessary to ensure many cache misses are avoided.

I would like to upgrade the stabilization method in qu3e at some point in the future, but currently don't know when the time will come since it would require a good amount of time.

Manifold Reduction

A collision manifold consists of contact points. Only 4 well chosen contact points are necessary (for discrete collision detection) to create a stable manifold. Many manifolds between two shapes can have much more than four contact points. Currently, if two boxes rest upon one another a total of 8 contact points may be created.

Reducing a manifold down to a constant maximum of 4 contact points will increase stability in the iterative contact solver. This reduction will also lower the memory cost of keeping manifolds in memory, thus increasing cache line efficiency as a side-effect.

Manifold reduction is not currently implemented in qu3e. Here is an algorithm overview, in case someone wants to try to implement it:

  • Query 2D contact plane with a constant direction for a support point, add this first point
  • Find the point farthest from the first point, this forms a line segment
  • Find third point farthest from previous segment to form a triangle
  • Find fourth point that maximizes area of the new quad in the 2D contact plane

For continuous collision detection the deepest point in the manifold needs be kept in the manifold. This can complicate the manifold reduction algorithm, and this complication is not discussed here.

Continuous Collision Detection

Continuous collision detection is not currently implemented in qu3e, but it's cool to have and great for general gameplay. Erin Catto has many free resources for implementing his Bilateral Advancement Time of Impact (TOI) solver. Erin's TOI solver can be used to find a TOI between two convex shapes. From here the Post Stabilization method (described above) can be used in conjunction with a computed TOI to prevent all tunnelining between Static/Dynamic and Static/Kinematic body pairs.

Dynamic to Dynamic or Kinematic to Dynamic continuous collision detection would involve running an O( N^2 ) algorithm with an unkown (and potentially huge) factor of N. For this reason these collision pairs are not discussed here.

At some point in the future I would love to use Erin's resources to implement some cool open source tools for continuous collision detection. Perhaps after I graduate from school this might be a good idea.

Multi-Threading Support

Multi-threading is an interesting topic and qu3e was written with threading in mind. A job system, or task system, would be ideal to batch together things like collision detection. Perhaps a threadpool will be added to qu3e by myself or some future contributor. A minor tweak to the q3Body island index would be needed. Some small memory alignment changes would also be needed. q3Stack can be used to allocate memory for jobs, since stack allocation is so fast.

Single Instruction Multiple Data (SIMD) Support

SIMD - I actually don't have experience using SIMD and all math in qu3e is scalar. This shouldn't really be a performance problem for anyone, but obviously it can be improved. However one clever bit of code is within Collide.cpp: the clipping of two 3D polygons is done via single dimensional lerps! This is a nice way of using scalar math to avoid the need for any SIMD in this particular case.

I do imagine that it would be pretty easy to swap in some open source math library for any bottlenecks, or by-hand code particular pieces.

Additional Collision Shapes (spheres, capsules, convex hulls, meshes)

Collision detection takes time to write, and while in school I don't have infinite time to dedicate to writing robust collision detection code. Spheres and capsules will likely be added by myself in the near future. Convex hulls and meshes are features in other physics engines, so it might not make sense for qu3e to compete -- especially since other open-source engines may just absorb code written for qu3e into their own codebases.

Advanced Joints and Springs

Advanced joints (springs, rods, revolute/prismatic joints) are a nice feature of other physics libraries, and qu3e might incorporate some. They aren't on any to-do list and wouldn't be added without user requests. Some joint types wouldn't clutter the library and can be fairly easy to use for those well versed with C++. The big problem with more advanced joints is setting them up. Often an editor or visual tool is the best way to setup joints, though qu3e itself would require raw C++ to be used.

Credits

Developed by Randy Gaul.

Erin Catto's online resources, such as Box2D provided a major inspiration to most of the code within qu3e. Special thank you to Dirk Gregorius and Nathan Carlson for the frequent and invaluable help and advice.

License

qu3e is licensed under the zlib license. See LICENSE.txt for more information.

Change Log

  • v1.00 : Initial version
  • v1.01 :
    • Raycasting
    • AABB query
    • Point query
    • q3Scene::Dump( FILE* ); Dump contents of scene as C++ file
    • Minor internal bug fixes, mostly with transforms for body->local space
    • Updated readme with large discussion of potential future features

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

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.

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. ๐Ÿ˜„

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?

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'

Size of box

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

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

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)

\
 \
  \
   \
    |
    |

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)."

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?

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.

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!

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.

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.

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.

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.

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!

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!

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.

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)

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!

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 ];

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).

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.

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.

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.

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?

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?

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.

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!

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

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

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.