[Mod] Rigidbody physics API [fysiks]

Post Reply
User avatar
krokoschlange
Member
Posts: 62
Joined: Sat Jul 02, 2016 08:33
GitHub: krokoschlange
In-game: krokoschlange

[Mod] Rigidbody physics API [fysiks]

by krokoschlange » Post

This is a rigidbody physics engine for minetest!

Example picture of some cubes dropped onto some nodes:
Image Image code: https://github.com/krokoschlange/fysiks
license: MIT
dependencies: none!


Registering your own rigidbodies is really simple, you just need to call:

Code: Select all

fysiks.register_rigidbody(name, def, rigidbody_def)
Details are in the repository (api.md).


Unfinished things:
  • more collider shapes (cylinder?)
Attachments
screenshot_20210315_181304_50.png
screenshot_20210315_181304_50.png (333.46 KiB) Viewed 1949 times
screenshot.png
screenshot.png (736.95 KiB) Viewed 1949 times
Last edited by krokoschlange on Mon Mar 15, 2021 17:18, edited 1 time in total.

User avatar
philipbenr
Member
Posts: 1897
Joined: Fri Jun 14, 2013 01:56
GitHub: philipbenr
IRC: philipbenr
In-game: robinspi
Location: United States

Re: [Mod][experimental] Rigidbody physics API [fysiks]

by philipbenr » Post

Oh this looks fun.

...I really don't have anything more to contribute, it just looks fun.

User avatar
krokoschlange
Member
Posts: 62
Joined: Sat Jul 02, 2016 08:33
GitHub: krokoschlange
In-game: krokoschlange

Re: [Mod][experimental] Rigidbody physics API [fysiks]

by krokoschlange » Post

Update:
I have been working on this quite a bit in the last week, so here's a little progress report:
  • Significant performance improvements
  • Nodebox collisions are now implemented
  • Collisions with normal entities are now implemented
  • Normal entities can be registered to experience collision feedback
  • Players can be registered to experience collision feedback
  • Players, entities and nodes can now have their own friction, bounciness and mass
  • There are now some callbacks for collisions
  • Friction coefficient calculation is now more reasonable
  • There is now a raycast function that detects collisionboxes from this mod
  • There is now a Blender addon that exports a mesh to lua which can be used as a collisionbox
  • The engine is now more configurable

User avatar
MisterE
Member
Posts: 693
Joined: Sun Feb 16, 2020 21:06
GitHub: MisterE123
IRC: MisterE
In-game: MisterE

Re: [Mod] Rigidbody physics API [fysiks]

by MisterE » Post

is this fast enough to actually be used on a server now?

User avatar
krokoschlange
Member
Posts: 62
Joined: Sat Jul 02, 2016 08:33
GitHub: krokoschlange
In-game: krokoschlange

Re: [Mod] Rigidbody physics API [fysiks]

by krokoschlange » Post

Possibly, yes. You might need to limit how players can spawn these objects. I haven't tested it on a server though, so I'm not sure. Another problem is that it could look quite laggy on the client side because of the frequent position updates. To make it a little more smooth you could enable the "fysiks_use_velocities" option in the settings, but that looks jerky as well. Just try it out and see if it works for you.

User avatar
MisterE
Member
Posts: 693
Joined: Sun Feb 16, 2020 21:06
GitHub: MisterE123
IRC: MisterE
In-game: MisterE

Re: [Mod] Rigidbody physics API [fysiks]

by MisterE » Post

Im thinking... of ships and seabattles :P

User avatar
ROllerozxa
Member
Posts: 157
Joined: Sun Apr 25, 2021 12:25
GitHub: ROllerozxa
IRC: ROllerozxa
In-game: ROllerozxa
Location: Sweden
Contact:

Re: [Mod] Rigidbody physics API [fysiks]

by ROllerozxa » Post

This mod is really fun, just spawning in some rigidbodies and playing around with them. I even recorded some of it.

In fact, this gets me in the mood for creating some sort of puzzle-based Minetest game based on this.

User avatar
MisterE
Member
Posts: 693
Joined: Sun Feb 16, 2020 21:06
GitHub: MisterE123
IRC: MisterE
In-game: MisterE

Re: [Mod] Rigidbody physics API [fysiks]

by MisterE » Post

any progress with the tank? Id be interested to see some stuff made with this...

User avatar
Andrey01
Member
Posts: 2574
Joined: Wed Oct 19, 2016 15:18
GitHub: Andrey2470T
In-game: Andrey01
Location: Russia, Moscow

Re: [Mod] Rigidbody physics API [fysiks]

by Andrey01 » Post

Just amazing mod! I was highly impressed by this mod after watching the mod review video made by NathanSalapat and also by some others. The last commit in your github repo is on 15th March, so is there any progress on fixing bugs/optimizing and are you going to add support for rigidbodies of more complex shapes?

User avatar
krokoschlange
Member
Posts: 62
Joined: Sat Jul 02, 2016 08:33
GitHub: krokoschlange
In-game: krokoschlange

Re: [Mod] Rigidbody physics API [fysiks]

by krokoschlange » Post

I currently don't have too much time to spend on this, sorry. The main thing I have been trying to figure out is getting a wheel collider to work properly but it's been a pain and isn't really usable yet. I am not aware of any bugs that should be fixed, stability issues are expected and can't be solved without completely rewriting everything to use better (and more complex) algorithms. The same goes for optimizations, I don't think there is too much to improve especially with the limitations of minetest. I'm not sure about more collider shapes (that are not polyhedra), because it's a lot of work and can usually be approximated with a polyhedron. If you want a polyhedron as a collider shape, use the blender plugin that's in the repo, there's also a (very short) readme there.

User avatar
Andrey01
Member
Posts: 2574
Joined: Wed Oct 19, 2016 15:18
GitHub: Andrey2470T
In-game: Andrey01
Location: Russia, Moscow

Re: [Mod] Rigidbody physics API [fysiks]

by Andrey01 » Post

krokoschlange wrote:
Sun Nov 21, 2021 20:34
I am not aware of any bugs that should be fixed
They are, e.g. there are pretty perceptible jerks of the woodbox or the test objects when they are moving at even low speed and the more such rigidbodies are spawned the those jerks are worse. Other bug is those objects sometimes "fall through" the floor or get stuck in the wall if they are compressed tightly by players which try to push them.
krokoschlange wrote:
Sun Nov 21, 2021 20:34
If you want a polyhedron as a collider shape, use the blender plugin that's in the repo, there's also a (very short) readme there.
Yes, I know about that plugin and already used it. But, as my test results show the problem is the rigidbody physics stops working correctly if it has a non-convex shape (it just falls though the underground as if it has '
physical = false' set). With the convex shapes they work fine.

User avatar
krokoschlange
Member
Posts: 62
Joined: Sat Jul 02, 2016 08:33
GitHub: krokoschlange
In-game: krokoschlange

Re: [Mod] Rigidbody physics API [fysiks]

by krokoschlange » Post

perceptible jerks of the woodbox or the test objects
Yes, unfortunately I don't think that this is fixable, it would require smoother object handling by the engine.
objects sometimes "fall through" the floor or get stuck in the wall if they are compressed tightly by players
Same thing here, it would require engine changes. Realistically, the player could stand on top of objects and could not push them into walls, but unfortunately it is pretty much impossible to stop the player from moving. The player is basically unstoppable.
the rigidbody physics stops working correctly if it has a non-convex shape
Yes, this is correct. Non-convex shapes are incredibly difficult to get working, so the workaround here is to split up your non-convex shape into several convex shapes.

User avatar
ywwv
Member
Posts: 299
Joined: Mon Jan 18, 2021 11:51

Re: [Mod] Rigidbody physics API [fysiks]

by ywwv » Post

you can use a BSP tree to divide a non-convex space into a set of convex spaces.

Post Reply

Who is online

Users browsing this forum: No registered users and 22 guests