🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Questions about destruction

Started by
3 comments, last by Finalspace 6 years, 11 months ago

I am playing around with destructions a bit, so i created a destructuable mesh, added it to a destructable compontent and tested it with a few actors beside each other.

When something hits it fully breaks into pieces, which are fine - but then the pieces damage the neighboring actors as well... which is not want i want.

- How can i setup the destructable component, that it never gets damaged when something hits it (I want to call ApplyDamage manually byself) ?

 

Also the pieces gets thrown in all 3 directions, but i want to be limited to some Plane.

- What must i set to limit the created pieces to a certain plane - like for example to the XY plane (for rotation as well) ?

 

I played around with the settings, but its far too much properties to tune - so its hard to find the right ones.

Advertisement
2 hours ago, Finalspace said:

but then the pieces damage the neighboring actors as well... which is not want i want.

Many ways to do it.

The first and most broad may be a flag that fragments don't collide with other fragments containing the same component. 

Another may be to maintain a list of non-destruction objects, or perhaps destruction-causing objects, on your component.  When fragments break off, mark their parents ID on the list.  When it comes time to collide, if any ID matches both lists or each other's IDs, the damage doesn't happen.

2 hours ago, Finalspace said:

Also the pieces gets thrown in all 3 directions, but i want to be limited to some Plane.

Depends on how they are moved in your game.  Immediately coming to mind, if they're physics driven, set them far enough apart they don't collide with each other, then apply forces along your plane.

2 hours ago, Finalspace said:

What must i set to limit the created pieces to a certain plane - like for example to the XY plane (for rotation as well)

There are many different representation of a plane and rotation by positions, some make this work easier than others.

Again with the first solution that jumps out at me, start with an axis of rotation through the explosion point. For example, if you want to spread them on the XY plane pick the Z axis, or the XZ plane pick the Y axis, if you've got some other plane pick the orthogonal axis. Select any angle of rotation around that axis for your directions. After that apply a rotation matrix for the direction you want to travel.  If you're spreading in n directions you may want to subdivide it into n blocks then pick a random angle within that block.
 

Just a word of warning. UE4's implementation of destruction rendering is completely unscalable. Each chunk becomes a draw call.

4 hours ago, frob said:

Many ways to do it.

The first and most broad may be a flag that fragments don't collide with other fragments containing the same component. 

Another may be to maintain a list of non-destruction objects, or perhaps destruction-causing objects, on your component.  When fragments break off, mark their parents ID on the list.  When it comes time to collide, if any ID matches both lists or each other's IDs, the damage doesn't happen.

Depends on how they are moved in your game.  Immediately coming to mind, if they're physics driven, set them far enough apart they don't collide with each other, then apply forces along your plane.

There are many different representation of a plane and rotation by positions, some make this work easier than others.

Again with the first solution that jumps out at me, start with an axis of rotation through the explosion point. For example, if you want to spread them on the XY plane pick the Z axis, or the XZ plane pick the Y axis, if you've got some other plane pick the orthogonal axis. Select any angle of rotation around that axis for your directions. After that apply a rotation matrix for the direction you want to travel.  If you're spreading in n directions you may want to subdivide it into n blocks then pick a random angle within that block.
 

Everything is physics driven and i basically want 2D destruction in a 3D top-down view. I havent found a setting how to configure the collision behavior...

Also i havent found a event yet how to get and control the created pieces.

 

1 hour ago, Syntac_ said:

Just a word of warning. UE4's implementation of destruction rendering is completely unscalable. Each chunk becomes a draw call.

This is no problem, because its a simple game with just a few actors (Maybe 100 at max). Also the pieces gets removed after some time (Gravity pulls them down into a kill trigger - when i solve the issue above)

This topic is closed to new replies.

Advertisement