Chaos Destruction for flying object, unable to disable gravity, actor falling

Hi,
I’m using UE4.26Chaoas build and I’m trying to apply destruction system to flying object.
The fractures created properly, fields applied and trigger as planned.
The thing is my flying geometry collection actor falls from the sky regardless gravity setting.
By default “simulate physics” is grayed out, so I guess “enable gravity” checkbox won’t work.
I was able to check “simulate physics” and uncheck “enable gravity” via blueprint, but it doesn’t change the falling behavior.
Tried “p.GeometryCollectionDisableGravity false” command, but no effect as well.
My flying actor properly responds to collisions (with projectiles, ground, other actor) and explodes as planned.
When I change “object type” to static fall doesn’t occur, but destruction freezes - expected.
What am I missing here?

I fixed this in UE5EA by going into Project Settings and setting default gravity Z to 0. I imagine this would apply to 4.2x Chaos implementations as well.

2 Likes

Try to set enable gravity to false for the actor’s GeometryCollectionComponent
image

Hi,

The gravity option has been fixed in the 5.1 release
If you are building from source and have access to the Unreal github repo, here’s the changes made to make that work
https://github.com/EpicGames/UnrealEngine/commit/88927fe4042443b5e6d203420b42461c9f20f747

Hope this helps

Cedric

2 Likes

Im working in ue5.3.2 and this issue is still here

@CedUE, hi. Thank for your answer! Is it possible to change gravity of geometry collection component at run time after initialization is completed? I tried using similar (but not the same) code, but failed. Also I would appreciate if you could answer another question - is it possible after disabling gravity to set zero velocity? SetPhysicsLinearVelocity() seems like not working. FSimulationParameters contains settings only for initial velocities.

For those, who need to enable gravity and other physics related things on geometry collection. By some reason Epic overrided method UGeometryCollectionComponent::GetBodyInstance() and it returns nullptr, instead of real BodyInstance from UPrimitiveComponent (at least in UE 5.3). As result - many of methods from UPrimitiveComponent become unavailable, because they get body instance by GetBodyInstance() and in case it is not valid, they do nothing. This is break of LSP (Liskov Substitution Principle), so not clear how even such code appeared in release.
But anyway. In case you need to implement SetGravityEnabled() or other methods from UPrimitiveComponent, you just need to inherit from UGeometryCollectionComponent and override those methods. Copy their implementation from UPrimitiveComponent and replace “GetBodyInstance()” with just direct access “BodyInstance”. After settings were changed in “BodyInstance”, you need to notify “physics proxy” of GC about it. So, every time something in “BodyInstance” is changed, you should call RecreatePhysicsState(). I would assume that this method can be quite expensive in terms of performance. So, if you need to change multiple settings in “BodyInstance”, you can call RecreatePhysicsState() only once after all changes are done.
Hope it will be useful to anyone.

1 Like

Thank you Alexey! This might be the key I need! Gonna try this and get back to you.

@AlexeyL2 Can you elaborate on

“After settings were changed in “BodyInstance”, you need to notify “physics proxy” of GC about it. So, every time something in “BodyInstance” is changed, you should call RecreatePhysicsState().”

I’m not sure what you meen by this, I tried looking though the Physics Proxy of the GeometryCollectionComponent but dident find anything related to adding a bodyinstance.