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


Java Ray.intersectsWherePlane方法代码示例

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


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

示例1: onAction

import com.jme3.math.Ray; //导入方法依赖的package包/类
public void onAction(String name, boolean isPressed, float tpf) {
    operation = name;
    if (isPressed) {
        supportedOperations.get(operation).setEnabled(true);
        Vector2f click2d = MonkeyBrainsAppState.getInstance().getApp().getInputManager().getCursorPosition();
        Vector3f click3d = agent.getCamera().getWorldCoordinates(new Vector2f(click2d.x, click2d.y), 0f).clone();
        Vector3f dir = agent.getCamera().getWorldCoordinates(new Vector2f(click2d.x, click2d.y), 1f).subtractLocal(click3d).normalizeLocal();
        Ray ray = new Ray(click3d, dir);
        Plane ground = new Plane(Vector3f.UNIT_Y, 0);
        Vector3f groundpoint = new Vector3f();
        ray.intersectsWherePlane(ground, groundpoint);
        ((SimpleAttackBehavior) supportedOperations.get(operation)).setTarget(groundpoint);
    } else {
        operation = null;
    }
}
 
开发者ID:QuietOne,项目名称:MonkeyBrains,代码行数:17,代码来源:SimplePlayerAttackBehavior.java

示例2: calculateMouseGroundPosition

import com.jme3.math.Ray; //导入方法依赖的package包/类
private void calculateMouseGroundPosition() {
    Vector2f mouse2dPosition = inputManager.getCursorPosition();
    Vector3f mouse3dPosition = cam
            .getWorldCoordinates(mouse2dPosition, 0.0f);

    Vector3f rayDirection = cam
            .getWorldCoordinates(mouse2dPosition, 1.0f)
            .subtractLocal(mouse3dPosition).normalizeLocal();

    Ray ray = new Ray(mouse3dPosition, rayDirection);
    ray.intersectsWherePlane(floorPlane, mouseGroundPosition);
}
 
开发者ID:TripleSnail,项目名称:Arkhados,代码行数:13,代码来源:UserCommandManager.java

示例3: calculateMouseLocation

import com.jme3.math.Ray; //导入方法依赖的package包/类
private void calculateMouseLocation() {
    Vector2f mouse2dPosition = inputManager.getCursorPosition();
    Vector3f mouse3dPosition =
            cam.getWorldCoordinates(mouse2dPosition, 0.0f);

    Vector3f rayDirection = cam.getWorldCoordinates(mouse2dPosition, 1.0f)
            .subtractLocal(mouse3dPosition).normalizeLocal();

    Ray ray = new Ray(mouse3dPosition, rayDirection);
    ray.intersectsWherePlane(floorPlane, intersectionPoint);
}
 
开发者ID:TripleSnail,项目名称:Arkhados,代码行数:12,代码来源:CFreeCamera.java


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