-
-
Notifications
You must be signed in to change notification settings - Fork 272
Ammo Physics (3D Physics Extension) #1974
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
Wow! It's very cool and useful for people like me) |
Thank you! I've been making steady progress, but it probably won't be ready for a while (which is why this is a draft). |
Added partial support compound bodies - all child shape types. |
wow |
Finally got convex hulls working 🥳 🎉 video.mp4Still have to optimize and bug fix everything and add more features |
Sorry to ping you, but I've got a quick question. I'm trying to add concave triangle mesh support but I can't decide how to go about parsing vertex and face data. I want to have a block that can do vertices and/or faces directly from a list and I want another block that can do OBJ files, but then it gets tricky because I have to have use cases for handling quads and n-gons when Ammo.js requires that all faces be triangles. Does Simple3D internally manage quads and n-gons or do you triangulate the mesh before uploading? If so, how difficult would it be to implement mesh triangulation from scratch, and which methods should I use? I was considering adding various triangulation methods or having a library do it for me, but wouldn't it be easier (albeit less user-friendly) to have it only accept OBJ files that are already triangulated (can't have more than 3 vertices per face)? E.g., require that users triangulate their meshes in Blender or something like that before importing |
I'm going to have to rewrite this horrible raycasting system, which means later release date |
Progress Update
@CubesterYT I know this isn't near ready for review yet... but whenever you can could you please take a quick look at the casting to make sure I did it right? |
You might want to hold off, I think I broke something in the last commit... convex hulls are clipping through bodies. |
I just removed the casting because I think that was what was causing the problems. Also don't know why my last commit passed ESLint but now it's warning me about things that should've thrown an error. I fixed those so now we should be good moving forward. I have to add mesh support for |
UpdateJust got some form of triangle meshes partially supported: video2.mp4Still have to clean it up, optimize and things. Only the dynamic (but slower) I have confirmed that these meshes support concave collisions, unlike convex hulls. Right now it only supports meshes where the data is from a Scratch list like this:
Where each item contains three separated coordinates and every three items corresponds to the vertices of one triangle. this means that all vertices must be in order. This means the example list above contains two triangles. There are multiple delimiter options available in the RegEx that splices this (spaces, commas, commas and spaces, and pipes). I have not yet added support for vertex indexing (e.g., the faces are determined by the items that correspond to a vertex instead of being in order) but that's planned before release. Vertex indexing will also make it easier to implement OBJ file processing, but OBJ files must be triangulated before importing into the Scratch lists as Ammo.js expects triangulated, planar meshes with no n-gons or non-manifold geometry. I also removed the casting and fixed the convex hulls. Task list:
|
They're very glitchy and there's a lot of tunneling when two impact meshes intersect... |
video.mp4@Xeltalliv Since you have experience writing physics engines, do you have any idea how to fix this? I've tried various things like changing maxSubSteps, simulation framerate, project framerate, etc. but nothing works. It only occurs when one or more I could try using a more specialized collision algorithm but I don't want to sacrifice performance for simpler simulations. |
Also, Ammo.js seems to support wireframe debug rendering. I might want to add a layer to the canvas that can show contacts, convex hulls, velocities, etc. |
This looks like a faulty collision detection. Changing framerate, sub-steps and solver iterations is mostly useful when you have a lot of bodies interacting in a chain reaction, which isn't the case here.
Not sure exactly what you are referring to, because there isn't much documentation, but I asked ChatGPT how to correctly use |
I'm already registering the GImpactCollisionAlgorithm, but ChatGPT suggests using a more narrow phase parent collision algorithm... I don't really think that will affect anything. Looking at the official demos,
|
This comment was marked as outdated.
This comment was marked as outdated.
Now ChatGPT is telling me that I can't do anything about it and to accept the limitations, but I know for sure it's possible. There's like twelve different GImpactMeshes all interacting here: video.mp4 |
I think my triangle solver is faulty and ChatGPT is too dumb to help me. I suppose I'll have to figure it out myself... |
Ammo Physics
A work-in-progress extension based on the ammo.js physics library, which is based on the C++ Bullet Physics SDK.
The goal is to provide feature-complete, advanced, and performant 3D physics in a simple-to-understand manner. This extension aims to be consistent with Box2D and Simple3D.
video.mp4
Task list:
Things I'm considering now or for a later update:
Miscellaneous Notes Mainly for Moderators:
Scratch.Cast
where necessary, right now I'm just working on functionality thoughPut an emoji (👍, 🚀) if you like this extension