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


Java Spatial.setLocalTranslation方法代码示例

本文整理汇总了Java中com.jme3.scene.Spatial.setLocalTranslation方法的典型用法代码示例。如果您正苦于以下问题:Java Spatial.setLocalTranslation方法的具体用法?Java Spatial.setLocalTranslation怎么用?Java Spatial.setLocalTranslation使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.jme3.scene.Spatial的用法示例。


在下文中一共展示了Spatial.setLocalTranslation方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: translateObjects

import com.jme3.scene.Spatial; //导入方法依赖的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: updateObject

import com.jme3.scene.Spatial; //导入方法依赖的package包/类
@Override
protected void updateObject(Spatial object, Entity e) {
    //only position will be updated during test
    PhysicsPosition pos = e.get(PhysicsPosition.class);
    object.setLocalTranslation(pos.getLocation());
    object.setLocalRotation(pos.getRotation());
}
 
开发者ID:jvpichowski,项目名称:ZayES-Bullet,代码行数:8,代码来源:TestBrickWall.java

示例3: applyPhysicsTransform

import com.jme3.scene.Spatial; //导入方法依赖的package包/类
protected void applyPhysicsTransform(@NotNull final Vector3f worldLocation, @NotNull final Quaternion worldRotation,
                                     @Nullable final Spatial spatial) {
    if (spatial == null) return;

    final Vector3f localLocation = spatial.getLocalTranslation();
    final Quaternion localRotation = spatial.getLocalRotation();

    final Node parent = spatial.getParent();

    if (parent == null) {
        spatial.setLocalTranslation(worldLocation);
        spatial.setLocalRotation(worldRotation);
    } else {

        localLocation.set(worldLocation)
                     .subtractLocal(parent.getWorldTranslation());

        localLocation.divideLocal(parent.getWorldScale());

        inverseWorldRotation.set(parent.getWorldRotation())
                            .inverseLocal()
                            .multLocal(localLocation);

        localRotation.set(worldRotation);

        inverseWorldRotation.set(parent.getWorldRotation())
                            .inverseLocal()
                            .mult(localRotation, localRotation);

        spatial.setLocalTranslation(localLocation);
        spatial.setLocalRotation(localRotation);
    }
}
 
开发者ID:JavaSaBr,项目名称:jmonkeybuilder-extension,代码行数:34,代码来源:AbstractPhysicsDebugControl.java

示例4: updateObject

import com.jme3.scene.Spatial; //导入方法依赖的package包/类
@Override
protected void updateObject(Spatial object, Entity e) {
    Vector3f loc = e.get(PhysicsPosition.class).getLocation();
    object.setLocalTranslation(loc);
}
 
开发者ID:jvpichowski,项目名称:ZayES-Bullet,代码行数:6,代码来源:ESDebugViewState.java

示例5: applyViewLocation

import com.jme3.scene.Spatial; //导入方法依赖的package包/类
private static void applyViewLocation(Entity entity, Spatial spatial){
    spatial.setLocalTranslation(entity.get(ViewLocation.class).getLocation());
}
 
开发者ID:jvpichowski,项目名称:ZayES-Bullet,代码行数:4,代码来源:ShapeViewState.java


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