I’m trying to have a flying target that the player can shoot at and explode when hit. I have created the geometry collection for the mesh, but obviously if I used it like that if falls and breaks into pieces. To achieve what I want I have tried several methods, none of them fully working in my case.
- Disable “Enable gravity” and/or “Simulate physics” in both the geometry collection and the parent object and then enabling it when the collision with the projectile is detected. Depending of the combination of this settings, either the target falls on begin play anyways or it stays floating but when the projectile hits it it doesn’t break.
- Use an anchor field at the center of the target and a field system in the projectile that damages the collection. This works as intended if I manually place the anchor in the scene, but when trying to spawn the targets at runtime the anchor is not working. I read that this has to be done in
OnCreatePhysicsState
in C++, but I had trouble instantiating the anchor there. I then tried disabling physics in the target, instantiating the field and adding it to theInitialization Fields
of the target, and then enable physics again. This kind of works, since the target floats and some pieces break when hit by the projectile, but it’s impossible to break the part where the anchor is placed (and destroying the anchor makes no difference). Besides, the breaking of the target is just in a small area around the hit of the projectile, and this does not happen when placing manually the anchor before playing the scene.
In brief, I want a way to spawn objects at runtime that stay in the air until a projectile hits them and they explode into pieces. This sounds simple enough, but I´ve been strugling with this the past few days, and I could use the help of anyone more experienced with the Chaos system.
Thanks in advance!