Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Partial destruction #9

Closed
mhoangvslev opened this issue Sep 18, 2017 · 3 comments
Closed

Partial destruction #9

mhoangvslev opened this issue Sep 18, 2017 · 3 comments

Comments

@mhoangvslev
Copy link

This idea may sound improbable: destruction weight painting.
You can precise the parts where you want the terrain to be destructible by simply paint on desired vertices.
Also the amount of destruction will be defined by the weight assigned to the vertex groups.

@Phyronnaz
Copy link
Owner

Phyronnaz commented Sep 18, 2017

Already doable. I'm going to create a wiki page to explain how to do it.

Edit: With the wiki you should be able to do it

@mhoangvslev
Copy link
Author

@Phyronnaz I believe that you are referring to this page. I don't see where you define destructibility of a given zone. If it is not the case, could you make more extensive documenting?

@Phyronnaz
Copy link
Owner

There are 2 ways of doing it:

  • Setting the values of the voxels to something higher than 1. This is quite easy to do, however it won't look great as it would deform the terrain
  • Setting a material to the voxels and creating a custom edit tool that checks whether the edited voxel contains this material (each voxel has 2 material blended by an alpha value). If it does, the edit strength is decreased.

To create this tool, I suggest you to copy/paste the SetValueProjection function, and replace this (and the similar call below) by this:

float CurrentStrength = Stength;
if (World->GetMaterial(Point).GetMax() /*Get the most visible material*/ == 255 /*Index of the material*/)
{
	CurrentStrength /= 10;
}
World->SetValue(Point, FMath::Clamp(World->GetValue(Point) - CurrentStrength, MinValue, MaxValue));

(not tested)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants