Java Code Examples for com.jme3.scene.Geometry#setLocalTransform()

The following examples show how to use com.jme3.scene.Geometry#setLocalTransform() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SceneToolController.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 6 votes vote down vote up
protected void attachBoxSelection(Spatial geom) {
    BoundingVolume bound = geom.getWorldBound();
    if (bound instanceof BoundingBox) {
        BoundingBox bbox = (BoundingBox) bound;
        Vector3f extent = new Vector3f();
        bbox.getExtent(extent);
        WireBox wireBox = new WireBox();
        wireBox.fromBoundingBox(bbox);
        selctionShapeOffset.set(bbox.getCenter()).subtractLocal(geom.getWorldTranslation());
        Geometry selectionGeometry = new Geometry("selection_geometry_sceneviewer", wireBox);
        selectionGeometry.setMaterial(blueMat);
        selectionGeometry.setLocalTransform(geom.getWorldTransform());
        selectionGeometry.setLocalTranslation(bbox.getCenter());
        toolsNode.attachChild(selectionGeometry);
        selectionShape = selectionGeometry;

    }
}
 
Example 2
Source File: SceneToolController.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 5 votes vote down vote up
protected void attachGeometrySelection(Geometry geom) {
    Mesh mesh = geom.getMesh();
    if (mesh == null) {
        return;
    }
    Geometry selectionGeometry = new Geometry("selection_geometry_sceneviewer", mesh);
    selectionGeometry.setMaterial(blueMat);
    selectionGeometry.setLocalTransform(geom.getWorldTransform());
    toolsNode.attachChild(selectionGeometry);
    selectionShape = selectionGeometry;
}