Is it possible to make my own rigidbody? How?

Hi guys.
I’m confused. Is it possible to make my own rigidbody system? Yeah, it’s like making brain surgery to a man :slight_smile:

I want to make my own rigidbody system but I don’t have any idea. Is it possible? If it’s, how can I make? Give me some logic, I don’t know the logic of the physics. The only thing that I know is the value of the gravity force. It’s 9.81 m/s2 on Earth :smiley:

Shortly, I want some logic and ideas from you.

P.S: I wouldn’t like to say that the default rigidbody component is bad. I would like to say that I want to learn new things that will improve my skills.

Sorry but if the only thing you know is the surface acceleration on earth i can definintely say: No, YOU can’t, at least not within the next few months.

Creating a physics system from scratch requires at least a well understanding of physics in general (both conceptionally and mathematically). Once you have that the next thing is the actual implementation of that concepts which requires a great understanding of the used programming language and the limits and capabilities of the used systems (hardware and framework limitations).

Unity doesn’t even ship their own physics system as it’s quite difficult to implement a performant system that scales well. Unity uses PhysX for 3d physics and Box2D for 2d physics.

If you want to roll your own rigidbody you want to fully understand the kinematic equations required as well as all dynamic equations. You should be familiar with matrices and coordinate spaces. Rotations and torque will give you the most headache when it comes to movement. For that you have to understand what the moment of inertia is, how you can calculate it and how to combine it. Next you should be familiar with tensor algebra or at least what a tensor is and how to use it.

This only covers the bare minimum required to get the rigidbody simulation working. We don’t have talked about collisions yet. Depending on your needs you might be able to simplify some things, even PhysX does this at several points. You probably should think about some sort of space partitioning unless you only have a few objects max. Though in most cases you will have some sort of static geometry (which we usually call a “level”). Apart from the actual collision detection you should be familiar with how elastic and inelastic collisions work mathematically as well as friction

I have partially rolled my own rigidbody system, though of course without collisions. I know most of physics inside out and it still took quite a bit of time to get it working properly. If you dream to beat any of the well established physics implementations with pretty much zero knowledge in those fields you can forget about it. Especially if your journey starts with a question like this.