当前位置: 首页>>代码示例>>Java>>正文


Java Node.setLocalTranslation方法代码示例

本文整理汇总了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);
}
 
开发者ID:JavaSaBr,项目名称:jmonkeybuilder,代码行数:38,代码来源:MoveToolControl.java

示例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);
}
 
开发者ID:JavaSaBr,项目名称:jmonkeybuilder,代码行数:19,代码来源:AbstractTransformControl.java

示例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();
    }
}
 
开发者ID:JavaSaBr,项目名称:jmonkeybuilder,代码行数:28,代码来源:AdvancedAbstractEditor3DState.java

示例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);
}
 
开发者ID:JavaSaBr,项目名称:jmonkeybuilder,代码行数:26,代码来源:AdvancedAbstractEditor3DState.java

示例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);
}
 
开发者ID:JavaSaBr,项目名称:jmonkeybuilder,代码行数:26,代码来源:AdvancedAbstractEditor3DState.java

示例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());
}
 
开发者ID:JavaSaBr,项目名称:jmonkeybuilder,代码行数:21,代码来源:EditorLightNode.java

示例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());
}
 
开发者ID:JavaSaBr,项目名称:jmonkeybuilder,代码行数:10,代码来源:EditorTransformSupport.java

示例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());
}
 
开发者ID:JavaSaBr,项目名称:jmonkeybuilder,代码行数:18,代码来源:EditorAudioNode.java

示例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());
}
 
开发者ID:JavaSaBr,项目名称:jmonkeybuilder,代码行数:30,代码来源:EditorAudioNode.java

示例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());
}
 
开发者ID:JavaSaBr,项目名称:jmonkeybuilder,代码行数:14,代码来源:EditorPresentableNode.java


注:本文中的com.jme3.scene.Node.setLocalTranslation方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。