本文整理匯總了Java中com.jme3.scene.Node.setLocalTranslation方法的典型用法代碼示例。如果您正苦於以下問題:Java Node.setLocalTranslation方法的具體用法?Java Node.setLocalTranslation怎麽用?Java Node.setLocalTranslation使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.jme3.scene.Node
的用法示例。
在下文中一共展示了Node.setLocalTranslation方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: translateObjects
import com.jme3.scene.Node; //導入方法依賴的package包/類
/**
* Process of moving objects.
*
* @param pickedAxis the moving axis.
* @param toTransform the moving object.
* @param transform the transform's center.
* @param distance the moving distance.
*/
private void translateObjects(@NotNull final PickedAxis pickedAxis, @NotNull final Spatial toTransform,
@NotNull final Transform transform, final float distance) {
final Node parentNode = getParentNode();
final Node childNode = getChildNode();
final EditorTransformSupport editorControl = getEditorControl();
final Quaternion rotation = parentNode.getLocalRotation();
final LocalObjects local = LocalObjects.get();
final Vector3f currentLocation = local.nextVector(parentNode.getLocalTranslation());
if (Config.DEV_TRANSFORMS_DEBUG) {
System.out.println("distance " + distance);
}
if (pickedAxis == PickedAxis.X) {
currentLocation.addLocal(getLeft(rotation, local.nextVector()).multLocal(distance));
} else if (pickedAxis == PickedAxis.Y) {
currentLocation.addLocal(getUp(rotation, local.nextVector()).multLocal(distance));
} else if (pickedAxis == PickedAxis.Z) {
currentLocation.addLocal(getDirection(rotation, local.nextVector()).multLocal(distance));
}
parentNode.setLocalTranslation(currentLocation);
toTransform.setLocalTranslation(childNode.getWorldTranslation());
editorControl.notifyTransformed(toTransform);
}
示例2: setCollisionPlane
import com.jme3.scene.Node; //導入方法依賴的package包/類
@Override
public void setCollisionPlane(@NotNull final CollisionResult collisionResult) {
final EditorTransformSupport editorControl = getEditorControl();
final Transform transform = editorControl.getTransformCenter();
if (transform == null) {
LOGGER.warning(this, "not found transform center for the " + editorControl);
return;
}
detectPickedAxis(editorControl, collisionResult);
// set the collision Plane location and rotation
final Node collisionPlane = getCollisionPlane();
collisionPlane.setLocalTranslation(transform.getTranslation());
collisionPlane.setLocalRotation(Quaternion.IDENTITY);
}
示例3: startCameraMoving
import com.jme3.scene.Node; //導入方法依賴的package包/類
/**
* Start to move the camera.
*/
@JMEThread
private void startCameraMoving(final int key) {
if (Config.DEV_CAMERA_DEBUG && LOGGER.isEnabled(LoggerLevel.DEBUG)) {
LOGGER.debug(this, "start camera moving[" + cameraMoving + "] for key " + key);
}
if (cameraMoving.get() == 0) {
final Camera camera = EDITOR.getCamera();
final Node nodeForCamera = getNodeForCamera();
nodeForCamera.setLocalTranslation(camera.getLocation());
final EditorCamera editorCamera = notNull(getEditorCamera());
editorCamera.setTargetDistance(0);
}
final boolean[] cameraKeysState = getCameraKeysState();
if (!cameraKeysState[key]) {
cameraKeysState[key] = true;
cameraMoving.incrementAndGet();
}
}
示例4: moveDirectionCamera
import com.jme3.scene.Node; //導入方法依賴的package包/類
/**
* Move a camera to direction.
*
* @param value the value to move.
*/
@JMEThread
private void moveDirectionCamera(final float value, final boolean isAction, final boolean isPressed, final int key) {
if (!canCameraMove()) return;
if (isAction && isPressed) startCameraMoving(key);
else if (isAction) finishCameraMoving(key, false);
if (!isCameraMoving() || isAction) return;
final EditorCamera editorCamera = getEditorCamera();
if (editorCamera == null) return;
final Camera camera = EDITOR.getCamera();
final Node nodeForCamera = getNodeForCamera();
final LocalObjects local = LocalObjects.get();
final Vector3f direction = camera.getDirection(local.nextVector());
direction.multLocal(value * cameraSpeed);
direction.addLocal(nodeForCamera.getLocalTranslation());
nodeForCamera.setLocalTranslation(direction);
}
示例5: moveSideCamera
import com.jme3.scene.Node; //導入方法依賴的package包/類
/**
* Move a camera to side.
*
* @param value the value to move.
*/
@JMEThread
private void moveSideCamera(final float value, final boolean isAction, final boolean isPressed, final int key) {
if (!canCameraMove()) return;
if (isAction && isPressed) startCameraMoving(key);
else if (isAction) finishCameraMoving(key, false);
if (!isCameraMoving() || isAction) return;
final EditorCamera editorCamera = getEditorCamera();
if (editorCamera == null) return;
final Camera camera = EDITOR.getCamera();
final Node nodeForCamera = getNodeForCamera();
final LocalObjects local = LocalObjects.get();
final Vector3f left = camera.getLeft(local.nextVector());
left.multLocal(value * cameraSpeed);
left.addLocal(nodeForCamera.getLocalTranslation());
nodeForCamera.setLocalTranslation(left);
}
示例6: updateModel
import com.jme3.scene.Node; //導入方法依賴的package包/類
/**
* Update position and rotation of a model.
*/
@JMEThread
public void updateModel() {
final Node model = getModel();
if (model == null) return;
final LocalObjects local = LocalObjects.get();
final Vector3f positionOnCamera = local.nextVector();
positionOnCamera.set(getLocalTranslation())
.subtractLocal(camera.getLocation())
.normalizeLocal()
.multLocal(camera.getFrustumNear() + 0.4f)
.addLocal(camera.getLocation());
model.setLocalTranslation(positionOnCamera);
model.setLocalRotation(getLocalRotation());
}
示例7: prepareToMove
import com.jme3.scene.Node; //導入方法依賴的package包/類
@Override
@JMEThread
public void prepareToMove(@NotNull final Node parent, @NotNull final Node child,
@NotNull final Transform transform, @NotNull final Camera camera) {
parent.setLocalTranslation(Vector3f.ZERO);
parent.setLocalRotation(Quaternion.IDENTITY);
child.setLocalTranslation(transform.getTranslation());
child.setLocalRotation(transform.getRotation());
}
示例8: sync
import com.jme3.scene.Node; //導入方法依賴的package包/類
/**
* Synchronize this node with audio node.
*/
@JMEThread
public void sync() {
final AudioNode audioNode = getAudioNode();
if (audioNode == null) return;
final LocalObjects local = LocalObjects.get();
final Quaternion rotation = local.nextRotation();
rotation.lookAt(audioNode.getDirection(), camera.getUp(local.nextVector()));
final Node editedNode = getEditedNode();
editedNode.setLocalRotation(rotation);
editedNode.setLocalTranslation(audioNode.getLocalTranslation());
}
示例9: updateModel
import com.jme3.scene.Node; //導入方法依賴的package包/類
/**
* Update position and rotation of a model.
*/
@JMEThread
public void updateModel() {
final AudioNode audioNode = getAudioNode();
final Node model = getModel();
if (model == null || audioNode == null) return;
final Node parent = audioNode.getParent();
if (parent != null) {
setLocalTranslation(parent.getWorldTranslation());
setLocalRotation(parent.getWorldRotation());
setLocalScale(parent.getWorldScale());
}
final Node editedNode = getEditedNode();
final LocalObjects local = LocalObjects.get();
final Vector3f positionOnCamera = local.nextVector();
positionOnCamera.set(editedNode.getWorldTranslation()).subtractLocal(camera.getLocation());
positionOnCamera.normalizeLocal();
positionOnCamera.multLocal(camera.getFrustumNear() + 0.4f);
positionOnCamera.addLocal(camera.getLocation());
model.setLocalTranslation(positionOnCamera);
model.setLocalRotation(editedNode.getLocalRotation());
}
示例10: sync
import com.jme3.scene.Node; //導入方法依賴的package包/類
/**
* Synchronize this node with presented object.
*/
@JMEThread
public void sync() {
final ScenePresentable object = getObject();
final Node editedNode = getEditedNode();
editedNode.setLocalRotation(object.getRotation());
editedNode.setLocalTranslation(object.getLocation());
editedNode.setLocalScale(object.getScale());
}