Physac - Printable Version +- QB64 Phoenix Edition (https://qb64phoenix.com/forum) +-- Forum: QB64 Rising (https://qb64phoenix.com/forum/forumdisplay.php?fid=1) +--- Forum: Expanding Horizons (Libraries) (https://qb64phoenix.com/forum/forumdisplay.php?fid=21) +---- Forum: a740g (https://qb64phoenix.com/forum/forumdisplay.php?fid=55) +---- Thread: Physac (/showthread.php?tid=3087) |
Physac - a740g - 09-30-2024 This is a standalone version of the Physac 2D physics engine ripped straight out of raylib-64. This version does not have any raylib dependencies (i.e. you can use the engine with vanilla QB64 graphics commands). As a bonus, it also contains the reasings library (Robert Penner's easing equations) and raymath (raylib math library). There are some support functions as well. See include/support.bi for documentation. There are 6 examples. 5 of them are for Physac and 1 for reasings. Documentation: Usage: Copy the complete "include" directory to your project location. And then (assuming your source files is at the root of the project location) do the following: Physac Code: (Select All)
reasings Code: (Select All)
raymath Code: (Select All)
Get the latest version directly from GitHub: raylib-64-master.zip RE: Physac - RokCoder - 09-30-2024 Fantastic - thanks! Now I just need a little time to do something with it RE: Physac - TerryRitchie - 09-30-2024 I was just chatting with another user about 2D physics engines. Karma, the good kind, has struck. Thank you. RE: Physac - grymmjack - 10-01-2024 AWESOME @a740g RE: Physac - Dav - 10-02-2024 Really nice, @a740g! Man, than easings example is smooooth. - Dav RE: Physac - RokCoder - 10-02-2024 I was playing around with this and discovered that CreatePhysicsBodyRectangle creates rectangles with very strange attributes. In the original C physics_demo.c, try replacing - Code: (Select All) CreatePhysicsBodyPolygon(GetMousePosition(), GetRandomValue(20, 80), GetRandomValue(3, 8), 10); Code: (Select All) CreatePhysicsBodyRectangle(GetMousePosition(), GetRandomValue(20, 80), GetRandomValue(20, 80), 10); RE: Physac - a740g - 10-02-2024 (10-02-2024, 10:50 PM)RokCoder Wrote: I was playing around with this and discovered that CreatePhysicsBodyRectangle creates rectangles with very strange attributes. In the original C physics_demo.c, try replacing -Yeah. That is crazy. There is an updated version of the library. I'll check if the updated version works better. RE: Physac - RokCoder - 10-03-2024 (10-02-2024, 11:55 PM)a740g Wrote: Yeah. That is crazy. There is an updated version of the library. I'll check if the updated version works better.As it stands, the little tower building project I had in mind is a no-go. It needs rectangles (and possibly more control over the friction, restitution, etc parameters). I've attached my little testbed project to give an idea of where it was going... and an even better idea of why it isn't going there any more physics-tower-game.zip (Size: 70.63 KB / Downloads: 17) RE: Physac - a740g - 10-14-2024 Updated library to the latest version of Physac and ported all Physac examples. Project is now hosted on GitHub. Download link is in the first post. @RokCoder, I still did not find a solution to your CreatePhysicsBodyRectangle issue. However, I'll keep looking. Will let you know if I find anything. RE: Physac - justsomeguy - 10-29-2024 I've been looking over the underlying code for the Physac engine, and its seems that it is a refactored version of the code I ported to QB64. Can it process objects with concave surfaces? The original code that this seem to be based off of, had a function set the rotation and removed any concave sides of the polygon, if you didn't run this after polygon creation, the object would behave erratically. I don't see the function here. Perhaps culled as unnecessary? Concave objects would be awesome, because then you could create things like gears and simple machines. I have kinda worked around this by joining two bodies with very rigid joints, but its not a very good workaround. It's cool that it uses threads so that should help with speed. It has nifty little function to shatter the polygons, could be useful for impact damage. The only down side is that it doesn't seem to have have joints. Maybe I missed it? Joints can add a lot to physics engine, you can look at some of the examples on my github. Perhaps that is something that they will add later on? Perhaps porting that back to c++ might be an option? Great job on bringing that to QB64! I will be keeping an eye on this in the future. |