Physics Mass Override

Is there any way to change the mass of a physics simulated static mesh?

Thanks.

1 Like

mass is calculated by the size of the object, in the physics option you can use Mass Scale to change the value.

Dear Skydive,

I’ve posted a tutorial on how you can change physics mass during runtime here!

Wiki Link

A new, community-hosted Unreal Engine Wiki - Announcements - Unreal Engine Forums!

Code from tutorial:

void AYourStaticMeshActorClass::SetMassScale(const float& NewScale)
{
	if(!StaticMeshComponent) return;
       //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
	FBodyInstance* BodyInst = StaticMeshComponent->GetBodyInstance();
 
	if(!BodyInst) return;
	//~~~~~~~~~~~~~~~~~~~~~~~~
 
	// New Scale 
	BodyInst->MassScale = NewScale;  
 
	// Trigger Update! 
	BodyInst->UpdateMassProperties();
}

Wow, ! You are phenomenal!

hee hee!

#:heart:

#corrected Link

UDN doesnt like my ! :slight_smile:

https://wiki.unrealengine.com/Mass_Scale_of_Physics_Mesh,_Dynamically_Update_During_Runtime!

Hi ,

Can you provide some recommended way to add physics to Actor with Procedural Mesh component which has been spawned in the scene at the runtime?

Thanks