Calculating Torque from acceleration to apply to rigidbody in AsyncPhysicsTickComponent

Hello,
I’m working on a physics based plugin, and I’ve ran into some problems with calculating the torque that should be applied to a Chaos::FRigidBodyHandle_Internal to have it accelerate at a designated speed.
The calculation I’m familiar with is: Torque = Impulse * Acceleration.
Which works fine in theory. The static mesh I am using for testing is a space ship from the synty POLYGON - Sci-Fi Space Pack, which means it’s not a “simple shape”. I assume that Unreal Engine 5 correctly calculates the inertia tensor for the simple collider correctly, so there’s no problem there as far as I am aware.

void MyPhysicsComponent::PhysicsTickAngularThrust(float DeltaTime, FVector2D& InInput)
{
	Chaos::FRigidBodyHandle_Internal* RigidBodyHandle = GetRigidBodyHandle();
	if (!RigidBodyHandle)
	{
		return;
	}

	const double InputX = InInput.X;

	const FVector Inertia = FVector(RigidBodyHandle->I());
	UE_LOG(LogTemp, Warning, TEXT("Inertia : %s"), *Inertia.ToString());

	const FVector Torque =  (FVector::UpVector * FMath::DegreesToRadians(AccelerationDeg) * InputX) * Inertia;
	UE_LOG(LogTemp, Warning, TEXT("Torque : %s"), *Torque.ToString());

	const FVector  AngularVelocity = RigidBodyHandle->GetW();
	UE_LOG(LogTemp, Warning, TEXT("AngularVelocity: %f dps"), FMath::RadiansToDegrees(AngularVelocity.Z));

	const FVector AngularAcceleration = (Torque / Inertia);
	const FVector AngularAccelerationDelta = AngularAcceleration * DeltaTime;

	UE_LOG(LogTemp, Warning, TEXT("AngularAcceleration: %f dps"), FMath::RadiansToDegrees(AngularAcceleration.Z));
	UE_LOG(LogTemp, Warning, TEXT("AngularAccelerationDelta: %f"), FMath::RadiansToDegrees(AngularAccelerationDelta.Z));
	
	RigidBodyHandle->AddTorque(Torque, true);
}

InputX = 1.0, AccelerationDeg = 360.0

However after having applied the torque for 1 second the log tells me that the rotational velocity is no where close to what is expected, it’s ~254 dps(degrees per second), instead of the expected 360 dps.

LogTemp: Warning: PhysixTimeElapsed : 1.000020
LogTemp: Warning: SimulationTime: 1.000020
LogTemp: Warning: Inertia : X=386486720.000 Y=166258528.000 Z=268873696.000
LogTemp: Warning: Torque : X=0.000 Y=0.000 Z=1689383303.206
LogTemp: Warning: AngularSpeed: 250.621907 dps
LogTemp: Warning: AngularAcceleration: 360.000010 dps
LogTemp: Warning: AngularAccelerationDelta: 6.000120

LogTemp: Warning: PhysixTimeElapsed : 1.016687
LogTemp: Warning: SimulationTime: 1.016687
LogTemp: Warning: Inertia : X=386486720.000 Y=166258528.000 Z=268873696.000
LogTemp: Warning: Torque : X=0.000 Y=0.000 Z=1689383303.206
LogTemp: Warning: AngularSpeed: 254.798950 dps
LogTemp: Warning: AngularAcceleration: 360.000010 dps
LogTemp: Warning: AngularAccelerationDelta: 6.000120

The log that is important is the 1.016687, as it is the time step after the 1second mark as those are the values after having been applied for 1 second.

So my question is if what I am doing is incorrect, and what is the correct way of calculating the Torque for a non-simple object as I have?

Resolved, Turns out I was looking at the wrong values :slight_smile: