當前位置: 首頁>>代碼示例>>Java>>正文


Java Vector3f.setY方法代碼示例

本文整理匯總了Java中com.jme3.math.Vector3f.setY方法的典型用法代碼示例。如果您正苦於以下問題:Java Vector3f.setY方法的具體用法?Java Vector3f.setY怎麽用?Java Vector3f.setY使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.jme3.math.Vector3f的用法示例。


在下文中一共展示了Vector3f.setY方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: applyVelocitySeparately

import com.jme3.math.Vector3f; //導入方法依賴的package包/類
private boolean applyVelocitySeparately(Vector3f velocity, float tpf){
    float x = velocity.getX();
    float y = velocity.getY();
    float z = velocity.getZ();
    boolean hit = false;

    velocity.set(0, 0, 0);

    velocity.setX(x);
    if(applyVelocity(velocity, tpf)) hit = true;
    velocity.setX(0);

    velocity.setY(y);
    if(applyVelocity(velocity, tpf)) hit = true;
    velocity.setY(0);

    velocity.setZ(z);
    if(applyVelocity(velocity, tpf)) hit = true;
    velocity.setZ(0);

    velocity.set(x, y, z);

    return hit;
}
 
開發者ID:DA-CS-Lab,項目名稱:Victorum,代碼行數:25,代碼來源:PlayerAppState.java

示例2: createSkyInBackground

import com.jme3.math.Vector3f; //導入方法依賴的package包/類
/**
 * The process of creating a new sky.
 */
@FXThread
private void createSkyInBackground() {

    final AssetManager assetManager = EDITOR.getAssetManager();

    final NodeTree<?> nodeTree = getNodeTree();
    final ChangeConsumer changeConsumer = notNull(nodeTree.getChangeConsumer());

    final FloatTextField normalScaleXSpinner = getNormalScaleXField();
    final FloatTextField normalScaleYSpinner = getNormalScaleYField();
    final FloatTextField normalScaleZSpinner = getNormalScaleZField();

    final Vector3f scale = new Vector3f();
    scale.setX(normalScaleXSpinner.getValue());
    scale.setY(normalScaleYSpinner.getValue());
    scale.setZ(normalScaleZSpinner.getValue());

    final ComboBox<SkyType> skyTypeComboBox = getSkyTypeComboBox();
    final SingleSelectionModel<SkyType> selectionModel = skyTypeComboBox.getSelectionModel();
    final SkyType selectedItem = selectionModel.getSelectedItem();

    if (selectedItem == SkyType.SINGLE_TEXTURE) {
        createSingleTexture(assetManager, changeConsumer, scale);
    } else if (selectedItem == SkyType.MULTIPLE_TEXTURE) {
        createMultipleTexture(assetManager, changeConsumer, scale);
    }
}
 
開發者ID:JavaSaBr,項目名稱:jmonkeybuilder,代碼行數:31,代碼來源:CreateSkyDialog.java

示例3: processTransform

import com.jme3.math.Vector3f; //導入方法依賴的package包/類
@Override
public void processTransform() {

    final EditorTransformSupport editorControl = getEditorControl();

    final LocalObjects local = LocalObjects.get();
    final Camera camera = editorControl.getCamera();
    final InputManager inputManager = EDITOR.getInputManager();
    final Transform transform = notNull(editorControl.getTransformCenter());

    // cursor position and selected position vectors
    final Vector2f cursorPos = inputManager.getCursorPosition();
    final Vector3f transformOnScreen = camera.getScreenCoordinates(transform.getTranslation(), local.nextVector());
    final Vector2f selectedCoords = local.nextVector(transformOnScreen.getX(), transformOnScreen.getY());

    // set new deltaVector if it's not set (scale tool stores position of a cursor)
    if (Float.isNaN(editorControl.getTransformDeltaX())) {
        editorControl.setTransformDeltaX(cursorPos.getX());
        editorControl.setTransformDeltaY(cursorPos.getY());
    }

    final Node parentNode = getParentNode();
    final Node childNode = getChildNode();

    // Picked vector
    final Spatial toTransform = notNull(editorControl.getToTransform());
    final TransformationMode transformationMode = editorControl.getTransformationMode();
    transformationMode.prepareToScale(parentNode, childNode, transform, camera);

    // scale according to distance
    final Vector3f deltaVector = local.nextVector(editorControl.getTransformDeltaX(), editorControl.getTransformDeltaY(), 0F);
    final Vector2f delta2d = local.nextVector(deltaVector.getX(), deltaVector.getY());
    final Vector3f baseScale = local.nextVector(transform.getScale()); // default scale
    final Vector3f pickedVector = local.nextVector(transformationMode.getScaleAxis(transform, editorControl.getPickedAxis(), camera));
    pickedVector.setX(abs(pickedVector.getX()));
    pickedVector.setY(abs(pickedVector.getY()));
    pickedVector.setZ(abs(pickedVector.getZ()));

    if (Config.DEV_TRANSFORMS_DEBUG) {
        System.out.println("Base scale " + baseScale + ", pickedVector " + pickedVector);
    }

    // scale object
    float disCursor = cursorPos.distance(selectedCoords);
    float disDelta = delta2d.distance(selectedCoords);
    float scaleValue = (float) (cursorPos.distance(delta2d) * 0.01f * Math.sqrt(baseScale.length()));

    if (disCursor > disDelta) {
        baseScale.addLocal(pickedVector.mult(scaleValue, local.nextVector()));
    } else {
        scaleValue = Math.min(scaleValue, 0.999f); // remove negateve values
        baseScale.subtractLocal(pickedVector.mult(scaleValue, local.nextVector()));
    }

    parentNode.setLocalScale(baseScale);

    if (Config.DEV_TRANSFORMS_DEBUG) {
        System.out.println("New scale " + baseScale + ", result world " + childNode.getWorldScale());
    }

    parentNode.setLocalScale(baseScale);
    toTransform.setLocalScale(childNode.getWorldScale());

    editorControl.notifyTransformed(toTransform);
}
 
開發者ID:JavaSaBr,項目名稱:jmonkeybuilder,代碼行數:66,代碼來源:ScaleToolControl.java


注:本文中的com.jme3.math.Vector3f.setY方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。