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.

@CedUE @AlexeyL2 this is so frustrating, any mention of gravity in the geometry collections physics proxy has been removed as of 5.4. Setting gravity and/or physics during runtime has no effect and the geometry collection component just floats in air.

Hi

Currently GeometryCollection component does not support changing the “Enable Gravity” at runtime, that’s something on our list to fix
In the mean time if you have access to code you effectively override the SetEnableGravity method in the GeometryCollectionComponent and forward it to the physics proxy as suggested by @AlexeyL2

Geometry collection are special in the sense that they can represent more than one physics object and a body instance can only represent one, that why externally the geometry collection returns null for the body instance

Thank you for the response! I haven’t been able to figure out how to forward it to the physics proxy, thats the part im stuck on. Is there any code example on how to do this or any leads you can give me?

I overrode the SetEnableGravity and SetSimulatePhysics functions but I cant figure out the physics proxy part that @AlexeyL2 and you @CedUE mentioned.

Hi,

I actually just finished implementing it in the main dev branch :slight_smile:
if you have access to the source code on github here’s the change :

https://github.com/EpicGames/UnrealEngine/commit/1be79a061bbbf4bbfc3f01232d4a2ccacd046771

1 Like

OMG THANK YOU! I’ll try it now thank you