# How to set inertia manually with chaos engine

**URL:** <https://forums.unrealengine.com/t/how-to-set-inertia-manually-with-chaos-engine/489591>\
**Category:** World Creation\
**Tags:** physx, unreal-engine, FeatureRequest, Physics, question\
**Created:** [October 6, 2021, 9:48am UTC](https://forums.unrealengine.com/t/how-to-set-inertia-manually-with-chaos-engine/489591 "2021-10-06T09:48:02Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![DragonLiSoftware](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/dragonlisoftware/32/703445_2.png) [@DragonLiSoftware](https://forums.unrealengine.com/u/DragonLiSoftware)\
**Post date:** [October 6, 2021, 9:48am UTC](https://forums.unrealengine.com/t/how-to-set-inertia-manually-with-chaos-engine/489591/1 "2021-10-06T09:48:02Z")

</div>

Hi, I would like to set the inertia tensor of physics body manually to do an accurate simulation.

For PhysX, I found that there is no function in components to directly do this, but I can directly interact with PhysX through this API([FPhysicsInterface\_PhysX::SetMassSpaceInertiaTensor\_AssumesLocked | Unreal Engine Documentation](https://docs.unrealengine.com/4.27/en-US/API/Runtime/Engine/Physics/FPhysicsInterface_PhysX/SetMassSpaceIner-/)); and at here ([[PHYSICS] Center of mass needs a rework - #9 by BoredEngineer](https://forums.unrealengine.com/t/physics-center-of-mass-needs-a-rework/98751/9)), the function UMMTBPFunctionLibrary::MMTSetInertiaTensor is a sample to use it.

However, for chaos physics engine, I cannot find an equivalent API. How should I set the inertia tensor manually for chaos?

---

<div class="post-metadata">

**Author:** ![vr\_marco](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/vr_marco/32/1194556_2.png) [@vr\_marco](https://forums.unrealengine.com/u/vr_marco)\
**Post date:** [October 11, 2021, 9:13am UTC](https://forums.unrealengine.com/t/how-to-set-inertia-manually-with-chaos-engine/489591/2 "2021-10-11T09:13:02Z")

</div>

To explicitly set the inertia tensor for a rigid body, you can call the Physics Interface with FPhysicsInterface::SetMassSpaceInertiaTensor\_AssumesLocked(Actor, MassSpaceInertiaTensor).  
If you check for example inside the Chaos Vehicles source code, this is what it is used within UpdateMassProperties.

```
void UChaosVehicleMovementComponent::UpdateMassProperties(FBodyInstance* BodyInstance)
    {
    	if (BodyInstance && FPhysicsInterface::IsValid(BodyInstance->ActorHandle) && FPhysicsInterface::IsRigidBody(BodyInstance->ActorHandle))
    	{
    		FPhysicsCommand::ExecuteWrite(BodyInstance->ActorHandle, [&](FPhysicsActorHandle& Actor)
    			{
    				const float MassRatio = this->Mass > 0.0f ? this->Mass / BodyInstance->GetBodyMass() : 1.0f;
    
    				FVector InertiaTensor = BodyInstance->GetBodyInertiaTensor();
    
    				InertiaTensor.X *= this->InertiaTensorScale.X * MassRatio;
    				InertiaTensor.Y *= this->InertiaTensorScale.Y * MassRatio;
    				InertiaTensor.Z *= this->InertiaTensorScale.Z * MassRatio;
    
    				FPhysicsInterface::SetMassSpaceInertiaTensor_AssumesLocked(Actor, InertiaTensor);
    				FPhysicsInterface::SetMass_AssumesLocked(Actor, this->Mass);
    			});
    	}
    
    }
```
