Destructible mesh world position

The world position of a destructible mesh does not update during simulation or play.

Hi ElectricSauce,

Can you post more information about the problem your having? Include screen shots and/or a more detailed description of how to setup the object so that I can replicate on my end and give you some information to work off of.

Thank you!

Tim

I’m building a projection material that requires the objects word position. The destructible mesh’s world position is not updated during play which causes texture swimming in my application.

https://lh6.googleusercontent.com/-ZGD9J-D6QbU/U_duyacIZwI/AAAAAAAACvc/JVfjVruirM4/w872-h919-no/DestructibeTexProjProblem1.pnghttp://

https://lh4.googleusercontent.com/-B3IgURDZxlk/U_duyqC3jJI/AAAAAAAACvg/YYUfNKX3uSs/w870-h919-no/DestructibeTexProjProblem3.pnghttp://

Images don’t seem to be loading properly:

https://lh4.googleusercontent.com/-B3IgURDZxlk/U_duyqC3jJI/AAAAAAAACvg/YYUfNKX3uSs/w870-h919-no/DestructibeTexProjProblem3.pnghttp://

One more time

Can you also post your material and how that is setup that the material function is being plugged into? I’m not able to get anything going here that could help you at the moment.

Thank you!

Hello electricsauce,

We are still happy to help you with your issue but have not received the assets needed to do so. If you still need help with your question please respond to this answer with a comment to keep it open. Also if you have any other questions or issues create a new post on the AnswerHub and we will be glad to assist you. Thanks!

I sent a copy of the project to Tim Hobson a month ago. PM me on the forums if you need another copy.

Hello again electricsauce,

With the help of a co-worker to understand your material function we discovered that you are taking the World Position of the entire mesh and subtracting that from the objects pivot position. Because the object pivot point on the individual pieces of the destructible mesh are centered, your vector math is not accounting for this change.

As for how to re-calculate for these new pivots on each piece of the destructible mesh, I am not too sure, but at least we discovered where and why your texture swimming is occurring.

I hope this gets you on your way to resolving your issue!

Cheers!

That’s exactly what I was pointing out. The destructible mesh does not update its position, even on the unbroken mesh.

When a destructible mesh breaks into pieces, those pieces generate new vertices at runtime. The material function you are using is a vertex specific shader so the destructible mesh pieces are in fact updating correctly when simulated/playing. Somewhere in your material you need to calculate for these new vertices being produced.

With an unbroken destructible mesh the world position does not update at runtime even when not using my material. If you make a blueprint that prints out the dm’s location it is also not updated during runtime.

Is there a way to get a reference to the new mesh pieces in blueprint so that I can feed them to my material.

Thanks.

When you have a destructible mesh and until a force is applied, like gravity, it is represented in the engine as a static object. When a force is applied to any extent, the mesh is broken into pieces. This is why your Destructible mesh location is not updated similar to a static mesh.

The engine would have to account for each piece being created, find the pivot point of each piece, and apply the material to its relative location. This is theoretically possible to do, but it would have to be done through code. Keep in mind this would be very performance heavy the larger the object or the more pieces you have.

Here is a start as to how to the location and rotation of your pieces of the destructible mesh on a previous AnswerHub post:

Thank you,

So essentially, a destructible mesh cannot move during runtime at all?

I don’t understand why you can’t get the position of an unbroken dm. Is there a way to temporarily turn off destruction? Apply a force and then re-enable it?

Hey Anslem,

There are a bunch of different ways to break a destructible mesh while in game. You can use simple player collision to break up the mesh, you can use gravity, or even a ‘Radial Force Actor.’

Destruction on Actor Hit

This is an example of fracturing a mesh when the player collides with the object. If the player is not in contact with the mesh, it will remain in-tact.

There are some really great and helpful examples within the ‘Content Examples’ project for destructible meshes. Here is the documentation page associated with the destructible level in the content examples.

Destructibles Content Examples

Let me know if you are able to get the functionality to work correctly, or if you need more assistance.

Cheers,