Java Code Examples for com.jme3.scene.Node#worldToLocal()
The following examples show how to use
com.jme3.scene.Node#worldToLocal() .
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: SceneEditorController.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 6 votes |
public void doAddModel(SpatialAssetDataObject file, Node selected, Vector3f location) { ProgressHandle progressHandle = ProgressHandleFactory.createHandle("Adding Model.."); progressHandle.start(); try { Spatial linkNode = file.loadAsset(); if (linkNode != null) { selected.attachChild(linkNode); if (location != null) { Vector3f localVec = new Vector3f(); selected.worldToLocal(location, localVec); linkNode.setLocalTranslation(localVec); } } refreshSelected(); addSpatialUndo(selected, linkNode, null, selectedSpat); } catch (Exception ex) { Confirmation msg = new NotifyDescriptor.Confirmation( "Error importing " + file.getName() + "\n" + ex.toString(), NotifyDescriptor.OK_CANCEL_OPTION, NotifyDescriptor.ERROR_MESSAGE); DialogDisplayer.getDefault().notifyLater(msg); } progressHandle.finish(); }
Example 2
Source File: SceneEditorController.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 6 votes |
public void doAddModel(Spatial file, Node selected, Vector3f location) { ProgressHandle progressHandle = ProgressHandleFactory.createHandle("Adding Model.."); progressHandle.start(); try { if (file != null) { selected.attachChild(file); if (location != null) { Vector3f localVec = new Vector3f(); selected.worldToLocal(location, localVec); file.setLocalTranslation(localVec); } } refreshSelected(); addSpatialUndo(selected, file, null, selectedSpat); } catch (Exception ex) { Confirmation msg = new NotifyDescriptor.Confirmation( "Error importing " + file.getName() + "\n" + ex.toString(), NotifyDescriptor.OK_CANCEL_OPTION, NotifyDescriptor.ERROR_MESSAGE); DialogDisplayer.getDefault().notifyLater(msg); } progressHandle.finish(); }
Example 3
Source File: TestRagDoll.java From jmonkeyengine with BSD 3-Clause "New" or "Revised" License | 5 votes |
private PhysicsJoint join(Node A, Node B, Vector3f connectionPoint) { Vector3f pivotA = A.worldToLocal(connectionPoint, new Vector3f()); Vector3f pivotB = B.worldToLocal(connectionPoint, new Vector3f()); ConeJoint joint = new ConeJoint(A.getControl(RigidBodyControl.class), B.getControl(RigidBodyControl.class), pivotA, pivotB); joint.setLimit(1f, 1f, 0); return joint; }
Example 4
Source File: TestRagDoll.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 5 votes |
private PhysicsJoint join(Node A, Node B, Vector3f connectionPoint) { Vector3f pivotA = A.worldToLocal(connectionPoint, new Vector3f()); Vector3f pivotB = B.worldToLocal(connectionPoint, new Vector3f()); ConeJoint joint = new ConeJoint(A.getControl(RigidBodyControl.class), B.getControl(RigidBodyControl.class), pivotA, pivotB); joint.setLimit(1f, 1f, 0); return joint; }