gecko0307 / dmech Goto Github PK
View Code? Open in Web Editor NEW3D physics engine for D
License: Boost Software License 1.0
3D physics engine for D
License: Boost Software License 1.0
It should be possible to bound geometries to world using dlib's new ownership mechanism.
Remove ManuallyAllocatable
from classes, move all internal data deallocation into destructors.
Hello,
I'd like to use the newer dlib
functionality, but unfortunately dmech
is still locked to an older version of dlib
.
I noticed that there was a commit bumping the dlib version to 0.17.
Could you perhaps release a patch version of dmech that updates the dlib dependency? Thanks!
Implement convex cast - essential for precise vehicle physics.
Hi,
I've been using dmech a very simple game demo/prototype. I'm impressed how much work is in these libraries - is this the work of one person?
Anyway, I ran into some issues with picking, so I created a cut-down application to investigate. In my application I was trying to use PhysicsWorld.raycast, but it seemed to return a body other than the one I was picking (I was using a local build from the master of dmech, and I'd modified PhysicsWorld.raycast to set the shape - as I had a rigid body with many shapes attached and wanted to see which one of them was picked).
I created a cut-down application to investigate picking - I created a 'plane' of cubes, arranged in the x-z plane, and put a camera over the center cube along the y axis looking onto the plane, and cast a ray to each cube's centre to test that picking worked.
I first created a demo in bullet for comparison: https://gist.github.com/taumuon/7948d557da1f5779ca98643a433c6e48
My dmech demo is at: https://gist.github.com/taumuon/a25ad4206d5e18add98381dc024a9ef5
I got the dmech demo giving the same results as the c++ bullet demo by picking testing against body directly, as in the dmech pyramid demo.
Trying to pick using PhysicsWorld.raycast doesn't work.
I had another question (which is probably more of a d language question rather than dmech), but if I change the line:
Vector3f origin = Vector3f(0, 10, 0);
to
Vector3f origin = new Vector3f(0, 10, 0);
then I get the wrong box picked (similar to what I'm seeing in my app). I'm curious this doesn't work, but why it compiles - is the vector boxed?
Thanks,
Gary
You claim "fully platform-independent" but you use DLib which does not support MacOS?
Hi,
dmech
is a really nice library with an excellent API.
But I've been having some performance trouble when I try running a larger number of shapes in it:
I made a benchmark program to demonstrate the issue: https://github.com/xdrie/dmech_perf_test
With 32
blocks and 2048
max collisions, it is pretty fast:
❯ ./dmech_perf_test --col 2048 --blk 32
dmech perf test (2048 max collisions, 32 blocks)
added 32 blocks
running benchmark (600 iterations)
result: 1.135 msec per iteration
With 64
blocks and 2048
max collisions, it is still quite fast:
❯ ./dmech_perf_test --col 2048 --blk 64
dmech perf test (2048 max collisions, 64 blocks)
added 64 blocks
running benchmark (600 iterations)
result: 2.80667 msec per iteration
With 256
blocks and 2048
max collisions, it slows down significantly, this would dip the FPS:
dmech perf test (2048 max collisions, 256 blocks)
added 256 blocks
running benchmark (600 iterations)
result: 18.0417 msec per iteration
With 512
blocks and 2048
max collisions, I ran the program for 90 seconds and it did not complete.
Anything higher or in that range gives similar results; the program seems to slow down exponentially with big numbers of rigid bodies.
Generally, with any numbers larger than this, the program will run for minutes and minutes, and will max out the CPU core, but will not complete.
DMD can compile dynamic libraries both under Windows and Linux, so it would be nice to allow dmech usage with other languages.
NonConvexGeometry
. In this case, Geometry
should be renamed into ConvexGeometry
.Capsule support function:
Vector3f supportPoint(Vector3f dir)
{
float half_h = height * 0.5f;
Vector3f pos1 = Vector3f(0.0f, 0.0f, half_h);
Vector3f pos2 = Vector3f(0.0f, 0.0f, -half_h);
Vector3f v = dir * radius;
pos1 += v;
pos2 += v;
if (dir.dot(pos1) > dir.dot(pos2))
return pos1;
else return pos2;
}
Convex hull support function:
Vector3f supportPoint(Vector3f dir)
{
float maxdot = -float.max;
Vector3f bestv;
foreach(v; vertices)
{
float d = dir.dot(v);
if (d > maxdot)
{
bestv = v;
maxdot = d;
}
}
return bestv;
}
based on #3:
pyramid and game --config build does not link (OSX, x64):
Linking...
Undefined symbols for architecture x86_64:
"_D4dlib8geometry8triangle8Triangle8opAssignMFNaNbNcNiNjNfS4dlib8geometry8triangle8TriangleZS4dlib8geometry8triangle8Triangle", referenced from:
_D4dlib4core6memory48__T8allocateTAS4dlib8geometry8triangle8TriangleZ8allocateFNbNimZAS4dlib8geometry8triangle8Triangle in pyramid.o
_D4dlib9container5array57__T12DynamicArrayTS4dlib8geometry8triangle8TriangleVmi32Z12DynamicArray10shiftRightMFNbZv in pyramid.o
_D4dlib9container5array57__T12DynamicArrayTS4dlib8geometry8triangle8TriangleVmi32Z12DynamicArray9shiftLeftMFNaNbNikZv in pyramid.o
_D4dlib9container5array57__T12DynamicArrayTS4dlib8geometry8triangle8TriangleVmi32Z12DynamicArray6appendMFNbS4dlib8geometry8triangle8TriangleZv in pyramid.o
_D4dlib9container5array57__T12DynamicArrayTS4dlib8geometry8triangle8TriangleVmi32Z12DynamicArray10appendLeftMFNbS4dlib8geometry8triangle8TriangleZv in pyramid.o
_D4dlib9container5array57__T12DynamicArrayTS4dlib8geometry8triangle8TriangleVmi32Z12DynamicArray13opIndexAssignMFNaNbNiS4dlib8geometry8triangle8TrianglemZS4dlib8geometry8triangle8Triangle in pyramid.o
_D4dlib9container5array55__T15reallocateArrayTS4dlib8geometry8triangle8TriangleZ15reallocateArrayFNbKAS4dlib8geometry8triangle8TrianglemZv in pyramid.o
...
ld: symbol(s) not found for architecture x86_64
Hello,
I would like to know if I can build a grappling hook system using dmech ?
Something like the hook in the game Teeworlds.
thanks
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.