AttackGorilla Posted September 9, 2020 Share Posted September 9, 2020 I have been able to fracture a mesh, but when it fractures it is not applying a material to the new surfaces within the fractured mesh. I saw elsewhere on the forum the use of [ bf.SetMaterial(shatteredMaterial.Name); ] but when I attempt to use this Unigine reports that bodyfracture does not contain a definition for SetMaterial Anyone have insight into where I am going wrong anyone able to provide a functional example? Here is the code I am using (C#): [ShowInEditor][Parameter(Tooltip = "Object for shattering")] private ObjectMeshDynamic mesh = null; [ShowInEditor][Parameter(Tooltip = "Shattered object Material")] private Material shatteredMaterial = null; private BodyFracture bf; private void Init() { Node n = World.GetNodeByName("ObjectMeshDynamic_2"); ObjectMeshDynamic mesh = n as ObjectMeshDynamic; BodyFracture bf =new BodyFracture(mesh); bf.Threshold = 0.05f; bf.Mass = 5f; bf.CreateShatterPieces(10); bf.Broken = true; bf.Material = shatteredMaterial.Name; } ... Link to comment
silent Posted September 9, 2020 Share Posted September 9, 2020 Please try to assign material before CreateShatterPieces in your code. Here is more information about BodyFracture usage: How to submit a good bug report --- FTP server for test scenes and user uploads: ftp://files.unigine.com user: upload password: 6xYkd6vLYWjpW6SN Link to comment
AttackGorilla Posted September 9, 2020 Author Share Posted September 9, 2020 That worked. Thank you. can't believe I missed that simple thing. thanks for the quick response. Link to comment
Recommended Posts