Trying to replicate Rigidbody.AddForceAtPosition

I’m working on a pretty specialized small physics simulation. It’s extremely narrow and only really needs to handle gravity and execute one behavior, the Rigidbody.AddForceAtPosition() function. And since it’s going to simulate a lot of identical bodies in the same way, I pretty sure I’m will gain a lot of performance by writing my own version i C which only does what I want super hard-coded.

The behavior works perfectly with a normal Rigidbody in Unity. So I’m trying to replicate my exact behavior (in C# first) without Unity’s (good, but bloated for my uses) physics engine.

I’ve started to replicate the AddForceAtPosition(), but I’m not getting the same behavior.
So TL;DR do you think this code does what AddForceAtPosition() does? Or are my physics off?

float mass = 1;
float inertia = 1;
// - Obv. not the real values -
Vector3 position =;
Quaternion rotation = Quaternion.identity;
Vector3 force =;
Vector3 force_point =;
// --

linear_velocity += gravity * delta_time;

Vector3 linear_acc =;
linear_acc = force / mass;

Vector3 angular_acc =;
angular_acc += Vector3.Cross(position - force_point, force) / inertia;

linear_velocity += linear_acc * delta_time;
angular_velocity += angular_acc * delta_time;

position = position + linear_velocity * delta_time;

rotation = rotation * Quaternion.Euler(angular_velocity);

Looks alright but the real test would be to simulate two identical objects by adding the same force, one with AddForceAtPosition, and one with your custom script.