christian.shiel Posted January 20, 2014 Share Posted January 20, 2014 I am working off the shatter examples. I have added an editor object called crate, it is setup as a dynamic mesh with a fracture. I call this code from script but nothing happens. Node n = engine.editor.getNodeByName("crate"); BodyFracture bf = class_cast("BodyFracture", n); bf.createShatterPieces(10); No errors in console either. Link to comment
sebastianbah Posted January 21, 2014 Share Posted January 21, 2014 Hello,You try to convert object to body and class_cast() converts an instance of one class to another without warnings, even if those classes have nothing in common.So, it's better to use the following code instead: Node n = engine.editor.getNodeByName("crate"); ObjectMeshDynamic mesh = class_cast("ObjectMeshDynamic", n); BodyFracture bf = body_cast(mesh.getBody()); bf.createShatterPieces(10); Also, check Threshold value in Nodes -> Body -> Threshold field. It should be less than 1. Link to comment
Recommended Posts