• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java Cylinder类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.jme3.scene.shape.Cylinder的典型用法代码示例。如果您正苦于以下问题:Java Cylinder类的具体用法?Java Cylinder怎么用?Java Cylinder使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Cylinder类属于com.jme3.scene.shape包,在下文中一共展示了Cylinder类的18个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: simpleInitApp

import com.jme3.scene.shape.Cylinder; //导入依赖的package包/类
@Override
public void simpleInitApp() {
    Cylinder t = new Cylinder(20, 50, 1, 2, true);
    Geometry geom = new Geometry("Cylinder", t);

    Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
    TextureKey key = new TextureKey("Interface/Logo/Monkey.jpg", true);
    key.setGenerateMips(true);
    Texture tex = assetManager.loadTexture(key);
    tex.setMinFilter(Texture.MinFilter.Trilinear);
    mat.setTexture("ColorMap", tex);

    geom.setMaterial(mat);
    
    rootNode.attachChild(geom);
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:17,代码来源:TestCylinder.java


示例2: initialize

import com.jme3.scene.shape.Cylinder; //导入依赖的package包/类
@Override
public void initialize() {
    super.initialize();
    Material mat = MaterialUtils.createTransparent(texture);
    mat.setColor("Color", color);

    Cylinder cylinder = new Cylinder(2, 16, radius, height);
    cylinderNode = new Geometry("TextureCylinderEffect_root", cylinder);
    cylinderNode.setMaterial(mat);

    // 默认贴图在xy平面上,当指定了其它方向时需要进行旋转,默认以逆时针旋转到指定平面
    if ("x".equals(axis)) {
        cylinderNode.rotate(0, FastMath.HALF_PI, 0);
    } else if ("y".equals(axis)) {
        cylinderNode.rotate(FastMath.HALF_PI, FastMath.HALF_PI, 0);
    } else if ("z".equals(axis)) {
        cylinderNode.rotate(0, 0, -FastMath.HALF_PI);
    }

    if (offset != null) {
        cylinderNode.setLocalTranslation(offset);
    }

    animNode.attachChild(cylinderNode);
}
 
开发者ID:huliqing,项目名称:LuoYing,代码行数:26,代码来源:TextureCylinderEffect.java


示例3: createArrow

import com.jme3.scene.shape.Cylinder; //导入依赖的package包/类
private Node createArrow(float coneRatio, float axisHeight, float axisRadius, Material mat, String transform) {
    float omConeRatio = 1 - coneRatio;
    Node xAxisNode = new Node();
    Cylinder cyl = new Cylinder(6, 12, axisRadius, axisHeight * coneRatio, true, false);
    Geometry xAxis1 = new Geometry("xCyl", cyl);
    xAxis1.setMaterial(mat);
    xAxis1.setLocalTranslation(0, 0, axisHeight * coneRatio / 2.0f);

    Cylinder cyl2 = new Cylinder(6, 24, 0.0f, axisRadius * 1.5f, axisHeight * omConeRatio, true, false);
    Geometry xAxis2 = new Geometry("xCone", cyl2);
    xAxis2.setMaterial(mat);
    xAxis2.setLocalTranslation(0, 0, axisHeight * (coneRatio + omConeRatio / 2));

    xAxis1.setUserData("Transform", transform);
    xAxis2.setUserData("Transform", transform);

    xAxisNode.attachChild(xAxis1);
    xAxisNode.attachChild(xAxis2);
    return xAxisNode;
}
 
开发者ID:samynk,项目名称:DArtE,代码行数:21,代码来源:Axis.java


示例4: createArrow

import com.jme3.scene.shape.Cylinder; //导入依赖的package包/类
private Node createArrow(float coneRatio, float axisHeight, float axisRadius, Material mat) {
    float omConeRatio = 1 - coneRatio;
    Node xAxisNode = new Node();
    Cylinder cyl = new Cylinder(6, 12, axisRadius, axisHeight * coneRatio, true, false);
    Vector2f scale = new Vector2f(1,5*(axisHeight* coneRatio));
    cyl.scaleTextureCoordinates( scale );
    Geometry xAxis1 = new Geometry("xCyl", cyl);
    xAxis1.setMaterial(mat);
    xAxis1.setLocalTranslation(0, 0, axisHeight * coneRatio / 2.0f);

    Cylinder cyl2 = new Cylinder(6, 24, 0.0f, axisRadius * 1.5f, axisHeight * omConeRatio, true, false);
    Vector2f scale2 = new Vector2f(5*(axisHeight* omConeRatio),5*(axisHeight* omConeRatio));
    cyl2.scaleTextureCoordinates(scale2);
    Geometry xAxis2 = new Geometry("xCone", cyl2);
    xAxis2.setMaterial(mat);
    xAxis2.setLocalTranslation(0, 0, axisHeight * (coneRatio + omConeRatio / 2));

    xAxisNode.attachChild(xAxis1);
    xAxisNode.attachChild(xAxis2);
    return xAxisNode;
}
 
开发者ID:samynk,项目名称:DArtE,代码行数:22,代码来源:PivotGizmo.java


示例5: initialize

import com.jme3.scene.shape.Cylinder; //导入依赖的package包/类
/**
 * Initializes the tool.
 *
 * @param manager the AssetManager to load objects and materials from.
 * @param inputManager can be used to register keypresses that can be used
 * with this tool.
 */
public void initialize(AssetManager manager, InputManager inputManager) {
    ObjectType objectType = GlobalObjects.getInstance().getObjectsTypeCategory().getObjectType("Terrain", "Brush");
    defaultBrush = (TerrainBrush)objectType.create(manager, "defaultbrush");
    defaultBrush.setLayerName("terrain");
    
    brushShape = new Cylinder(2, 12, defaultBrush.getRadius(), 1.0f);
    brushGizmo = new Geometry("terrainBrush", brushShape);
    Quaternion q = new Quaternion();
    q.fromAngles(FastMath.HALF_PI, 0, 0);
    brushGizmo.setLocalRotation(q);
    brushGizmo.setMaterial(manager.loadMaterial("Materials/BrushGizmoMaterial.j3m"));

    inputManager.addListener(shiftListener, new String[]{"DOBRUSH"});
    
    GlobalObjects.getInstance().registerListener(this);
    
}
 
开发者ID:samynk,项目名称:DArtE,代码行数:25,代码来源:BrushTool.java


示例6: execute

import com.jme3.scene.shape.Cylinder; //导入依赖的package包/类
@Override
public EffectHandle execute(Node root, Vector3f loc, String param) {
    CCharacterPhysics phys = root.getControl(CCharacterPhysics.class);
    float height = phys.getCapsuleShape().getHeight();
    float radius = phys.getCapsuleShape().getRadius();

    Mesh mesh = new Cylinder(2, 32, 1f, 0.1f, true);
    Geometry geom = new Geometry("backlash-action", mesh);
    geom.scale(radius * 1.75f, height, radius * 1.75f);
    geom.setLocalTranslation(0f, 1f, 0f);

    Material mat = new Material(Globals.assets,
            "MatDefs/Backlash/Backlash.j3md");
    mat.getAdditionalRenderState()
            .setBlendMode(RenderState.BlendMode.AlphaAdditive);
    mat.getAdditionalRenderState().setFaceCullMode(RenderState.FaceCullMode.Off);
    geom.setQueueBucket(RenderQueue.Bucket.Transparent);
    geom.setMaterial(mat);

    root.attachChild(geom);

    return () -> {
        geom.removeFromParent();
    };
}
 
开发者ID:TripleSnail,项目名称:Arkhados,代码行数:26,代码来源:Backlash.java


示例7: refreshMesh

import com.jme3.scene.shape.Cylinder; //导入依赖的package包/类
private void refreshMesh(Node node, Entity e){
    float r = e.get(CapsuleView.class).getRadius();
    float h = e.get(CapsuleView.class).getHeight();
    Geometry cylinder = new Geometry("cylinder", new Cylinder(16, 16, r, h));
    Geometry top = new Geometry("top sphere", new Sphere(16,16, r));
    Geometry bottom = new Geometry("bottom sphere", new Sphere(16, 16, r));
    cylinder.rotate(FastMath.HALF_PI, 0, 0);
    bottom.setLocalTranslation(0, -h/2, 0);
    top.setLocalTranslation(0, h/2,0);
    node.attachChild(cylinder);
    node.attachChild(bottom);
    node.attachChild(top);
}
 
开发者ID:jvpichowski,项目名称:ZayES-Bullet,代码行数:14,代码来源:CapsuleView.java


示例8: createMesh

import com.jme3.scene.shape.Cylinder; //导入依赖的package包/类
@Override
@FXThread
protected @NotNull Mesh createMesh(@NotNull final VarTable vars) {
    final int axisSamples = vars.getInteger(PROPERTY_AXIS_SAMPLES);
    final int radialSamples = vars.getInteger(PROPERTY_RADIAL_SAMPLES);
    final float radius = vars.getFloat(PROPERTY_RADIUS);
    final float height = vars.getFloat(PROPERTY_HEIGHT);
    return new Cylinder(axisSamples, radialSamples, radius, height);
}
 
开发者ID:JavaSaBr,项目名称:jmonkeybuilder,代码行数:10,代码来源:CreateCylinderShapeEmitterAction.java


示例9: simpleInitApp

import com.jme3.scene.shape.Cylinder; //导入依赖的package包/类
@Override
public void simpleInitApp() {
    bulletAppState = new BulletAppState();
    stateManager.attach(bulletAppState);
    bulletAppState.getPhysicsSpace().enableDebug(assetManager);
    createMaterial();

    Node node = new Node("node1");
    attachRandomGeometry(node, mat1);
    randomizeTransform(node);

    Node node2 = new Node("node2");
    attachRandomGeometry(node2, mat2);
    randomizeTransform(node2);

    node.attachChild(node2);
    rootNode.attachChild(node);

    RigidBodyControl control = new RigidBodyControl(0);
    node.addControl(control);
    getPhysicsSpace().add(control);

    //test single geometry too
    Geometry myGeom = new Geometry("cylinder", new Cylinder(16, 16, 0.5f, 1));
    myGeom.setMaterial(mat3);
    randomizeTransform(myGeom);
    rootNode.attachChild(myGeom);
    RigidBodyControl control3 = new RigidBodyControl(0);
    myGeom.addControl(control3);
    getPhysicsSpace().add(control3);
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:32,代码来源:TestCollisionShapeFactory.java


示例10: makeCylinder

import com.jme3.scene.shape.Cylinder; //导入依赖的package包/类
public Geometry makeCylinder(String name, float radius, float height, int sides,
            ColorRGBA color) {
        Material mat = new Material(assetManager,
                "Common/MatDefs/Light/Lighting.j3md");
        mat.setBoolean("UseMaterialColors", true);
        mat.setColor("Ambient", color.mult(0.8f));
        mat.setColor("Diffuse", color);
        mat.setColor("Specular", ColorRGBA.White);
//        mat.setBoolean("HighQuality", false);
        Geometry cylinder = new Geometry(name, new Cylinder(32, sides, radius, height, true));
        cylinder.setMaterial(mat);

        return cylinder;
    }
 
开发者ID:dwhuang,项目名称:SMILE,代码行数:15,代码来源:Factory.java


示例11: setupShip

import com.jme3.scene.shape.Cylinder; //导入依赖的package包/类
private void setupShip() {
    Cylinder n = new Cylinder(30, 30, 0.25f, 1f);
    Geometry nose = new Geometry("Nose", n);
    Material mat = new Material(assetManager, "Common/MatDefs/Light/Lighting.j3md");
    mat.setBoolean("UseMaterialColors", true);
    mat.setColor("Ambient", ColorRGBA.Gray);
    mat.setColor("Diffuse", ColorRGBA.Blue);
    mat.setColor("Specular", ColorRGBA.White);
    mat.setFloat("Shininess", 1);
    nose.setMaterial(mat);

    Sphere b = new Sphere(30, 30, 1f, true, false);
    Geometry body = new Geometry("Body", b);
    body.setMaterial(mat);
    body.setLocalTranslation(0, -0.5f, 0);
    ship = new Node("Ship");
    ship.attachChild(nose);
    ship.attachChild(body);

    ship.getChild("Nose").setLocalTranslation(0, 0, 1);
    ship.getChild("Body").setLocalTranslation(0, 0, 0);

    System.out.println("setting radius to: 1.0");
    ship.setUserData("radius", new Float(1f));
    rootNode.attachChild(ship);

    vel = new Vector3f(0, 0, 0);
    accel = new Vector3f(0, 0, 0);
}
 
开发者ID:mifth,项目名称:JME-Simple-Examples,代码行数:30,代码来源:AsteroidsMiniGame.java


示例12: createShape

import com.jme3.scene.shape.Cylinder; //导入依赖的package包/类
private void createShape(Prefab parent) {
    Cylinder cyl = new Cylinder(axialSegments, radialSegments, radius, getHeight(), true);
    cylinderGeo = new Geometry("cylinder", cyl);
    AssetManager am = GlobalObjects.getInstance().getAssetManager();
    cylinderMat = am.loadMaterial("Materials/RigMaterial.j3m");
    cylinderGeo.setMaterial(cylinderMat);
    resetColor();
    cylinderGeo.setLocalRotation(getRotation());
    parent.attachChild(cylinderGeo);
}
 
开发者ID:samynk,项目名称:DArtE,代码行数:11,代码来源:CylinderComponent.java


示例13: getMesh

import com.jme3.scene.shape.Cylinder; //导入依赖的package包/类
@Override
protected Mesh getMesh(Entity e) {
    CylinderView cylinder = e.get(CylinderView.class);
    return new Cylinder(16, 16, cylinder.getRadius(), cylinder.getHeight(), true);
}
 
开发者ID:jvpichowski,项目名称:ZayES-Bullet,代码行数:6,代码来源:CylinderView.java


示例14: showMarkers

import com.jme3.scene.shape.Cylinder; //导入依赖的package包/类
private void showMarkers() {

		tweed.enqueue( new Runnable() { // run after toAlign's local transofrm has been updated!
			@Override
			public void run() {
		
		for ( Spatial s : markers.getChildren() )
			s.removeFromParent();

		
		Vector3f[] targetMarkers;
		if ( toAlign != null ) {
			Transform toTarget = toAlign.gNode.getLocalTransform();

			targetMarkers = new Vector3f[alignMarkers.length];

			for ( int i = 0; i < alignMarkers.length; i++ ) {
				if ( alignMarkers[ i ] != null ) {
					targetMarkers[ i ] = new Vector3f();
					toTarget.transformVector( alignMarkers[ i ], targetMarkers[ i ] );
				}
			}
		} else
			targetMarkers = new Vector3f[2];
		
		int cc = 4;
		for ( Vector3f[] a : new Vector3f[][] { otherMarkers, targetMarkers } ) {
			
			Color c = Rainbow.getColour( cc++ );
			
			for ( Vector3f v : a ) {
				if ( v != null ) {

					Cylinder handleOne = new Cylinder( 2, 3, 0.05f, 500f, true );
					
					handleOne.setMode( Mode.Lines );
					
					Geometry g1 = new Geometry( "h1", handleOne );
					
					Material mat1 = new Material( tweed.getAssetManager(), "Common/MatDefs/Misc/Unshaded.j3md" );
					mat1.setColor( "Color", new ColorRGBA (c.getRed() / 255f, c.getGreen() / 255f, c.getBlue() / 255f, 1f ) ) ;
					g1.setMaterial( mat1 );
					Vector3f pos = new Vector3f( v );
					pos = pos.add( 0, 250, 0 );
					g1.setLocalTranslation( pos );
					g1.setLocalRotation( new Quaternion( new float[] {FastMath.PI/2, 0, 0} ) );
					markers.attachChild(g1);
				}

			}
		}
			}
		});

	}
 
开发者ID:twak,项目名称:chordatlas,代码行数:56,代码来源:AlignTool.java


示例15: buildPlayer

import com.jme3.scene.shape.Cylinder; //导入依赖的package包/类
private void buildPlayer() {
    Material mat = new Material(getAssetManager(), "Common/MatDefs/Misc/Unshaded.j3md");
    mat.getAdditionalRenderState().setWireframe(true);
    mat.setColor("Color", ColorRGBA.Red);

    //create a compound shape and attach the BoxCollisionShape for the car body at 0,1,0
    //this shifts the effective center of mass of the BoxCollisionShape to 0,-1,0
    CompoundCollisionShape compoundShape = new CompoundCollisionShape();
    BoxCollisionShape box = new BoxCollisionShape(new Vector3f(1.2f, 0.5f, 2.4f));
    compoundShape.addChildShape(box, new Vector3f(0, 1, 0));

    //create vehicle node
    Node vehicleNode=new Node("vehicleNode");
    vehicle = new VehicleControl(compoundShape, 400);
    vehicleNode.addControl(vehicle);

    //setting suspension values for wheels, this can be a bit tricky
    //see also https://docs.google.com/Doc?docid=0AXVUZ5xw6XpKZGNuZG56a3FfMzU0Z2NyZnF4Zmo&hl=en
    float stiffness = 60.0f;//200=f1 car
    float compValue = .3f; //(should be lower than damp)
    float dampValue = .4f;
    vehicle.setSuspensionCompression(compValue * 2.0f * FastMath.sqrt(stiffness));
    vehicle.setSuspensionDamping(dampValue * 2.0f * FastMath.sqrt(stiffness));
    vehicle.setSuspensionStiffness(stiffness);
    vehicle.setMaxSuspensionForce(10000.0f);

    //Create four wheels and add them at their locations
    Vector3f wheelDirection = new Vector3f(0, -1, 0); // was 0, -1, 0
    Vector3f wheelAxle = new Vector3f(-1, 0, 0); // was -1, 0, 0
    float radius = 0.5f;
    float restLength = 0.3f;
    float yOff = 0.5f;
    float xOff = 1f;
    float zOff = 2f;

    Cylinder wheelMesh = new Cylinder(16, 16, radius, radius * 0.6f, true);

    Node node1 = new Node("wheel 1 node");
    Geometry wheels1 = new Geometry("wheel 1", wheelMesh);
    node1.attachChild(wheels1);
    wheels1.rotate(0, FastMath.HALF_PI, 0);
    wheels1.setMaterial(mat);
    vehicle.addWheel(node1, new Vector3f(-xOff, yOff, zOff),
            wheelDirection, wheelAxle, restLength, radius, true);

    Node node2 = new Node("wheel 2 node");
    Geometry wheels2 = new Geometry("wheel 2", wheelMesh);
    node2.attachChild(wheels2);
    wheels2.rotate(0, FastMath.HALF_PI, 0);
    wheels2.setMaterial(mat);
    vehicle.addWheel(node2, new Vector3f(xOff, yOff, zOff),
            wheelDirection, wheelAxle, restLength, radius, true);

    Node node3 = new Node("wheel 3 node");
    Geometry wheels3 = new Geometry("wheel 3", wheelMesh);
    node3.attachChild(wheels3);
    wheels3.rotate(0, FastMath.HALF_PI, 0);
    wheels3.setMaterial(mat);
    vehicle.addWheel(node3, new Vector3f(-xOff, yOff, -zOff),
            wheelDirection, wheelAxle, restLength, radius, false);

    Node node4 = new Node("wheel 4 node");
    Geometry wheels4 = new Geometry("wheel 4", wheelMesh);
    node4.attachChild(wheels4);
    wheels4.rotate(0, FastMath.HALF_PI, 0);
    wheels4.setMaterial(mat);
    vehicle.addWheel(node4, new Vector3f(xOff, yOff, -zOff),
            wheelDirection, wheelAxle, restLength, radius, false);

    vehicleNode.attachChild(node1);
    vehicleNode.attachChild(node2);
    vehicleNode.attachChild(node3);
    vehicleNode.attachChild(node4);
    rootNode.attachChild(vehicleNode);

    getPhysicsSpace().add(vehicle);
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:78,代码来源:TestPhysicsCar.java


示例16: simpleInitApp

import com.jme3.scene.shape.Cylinder; //导入依赖的package包/类
@Override
public void simpleInitApp() {

    Material mat = new Material(assetManager, "Common/MatDefs/Light/Lighting.j3md");
    
    Material mat_box = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
    mat_box.setColor("Color", ColorRGBA.Blue);
    
    Material mat_wire = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
    mat_wire.setColor("Color", ColorRGBA.Cyan);
    mat_wire.getAdditionalRenderState().setWireframe(true);
    
    Mesh sphr = new Sphere(10, 10, 1f);
    Mesh cyl = new Cylinder(10,10,1,1,true);
    Mesh bxWire = new Box(1,1,1);
    geom = new Geometry("Sphere", sphr);
    geom.scale(2,1,1);  //check if scale works with bx correctly
  
    wbx = new WireBox();
    wbx.fromBoundingBox((BoundingBox) geom.getWorldBound());
    
    bx = new Geometry("TheMesh", wbx);
    bx.setMaterial(mat_box);
    rootNode.attachChild(bx);
    
    geom.setMaterial(mat);
    rootNode.attachChild(geom);

    geom2 = new Geometry("Boxxx", cyl);
    geom2.setMaterial(mat);
    geom2.setLocalTranslation(5, 0, 0);
    geom2.setLocalScale(2, 1, 1);
    rootNode.attachChild(geom2);
    
    bx2 = new Geometry("TheMesh", sphr);
    bx2.setMaterial(mat_wire);
    rootNode.attachChild(bx2);
    
    
    DirectionalLight dl = new DirectionalLight();
    dl.setDirection(new Vector3f(-0.63f, -0.463f, -0.623f).normalizeLocal());
    dl.setColor(new ColorRGBA(1,1,1,1));
    rootNode.addLight(dl);        
  
    viewPort.setBackgroundColor(ColorRGBA.Gray);
    flyCam.setMoveSpeed(30);
    
}
 
开发者ID:mifth,项目名称:JME-Simple-Examples,代码行数:49,代码来源:DrawCollisionBox.java


示例17: createRobot

import com.jme3.scene.shape.Cylinder; //导入依赖的package包/类
private Node createRobot(String name) {
    Node res = new Node(name);

    // create the feet
    Box leftFoot = new Box(0.5f, 0.2f, 1.5f);
    Box rightFoot = new Box(0.5f, 0.2f, 1.5f);
    Geometry geomlf = new Geometry("leftFoot", leftFoot);
    Geometry geomrf = new Geometry("rightFoot", rightFoot);
    Material matf = mat.clone();
    matf.setColor("Color", ColorRGBA.DarkGray);
    geomlf.setMaterial(matf);
    geomrf.setMaterial(matf);
    geomlf.center().move(new Vector3f(1, 0.21f, 0));
    geomrf.center().move(new Vector3f(-1, 0.21f, 0));

    res.attachChild(geomlf);
    res.attachChild(geomrf);

    // create the body
    Cylinder body = new Cylinder(8, 16, 1, 3);
    Geometry bodygeom = new Geometry("body", body);
    Material matb = mat.clone();
    matb.setColor("Color", ColorRGBA.Gray);
    bodygeom.setMaterial(matb);
    bodygeom.center().move(new Vector3f(0, 1.92f, 0));
    bodygeom.rotate(FastMath.DEG_TO_RAD * 90, 0, 0);
    res.attachChild(bodygeom);

    // create the head
    Sphere head = new Sphere(16, 32, 1.5f);
    Geometry headgeom = new Geometry("head", head);
    Material math = mat.clone();
    math.setColor("Color", ColorRGBA.Gray);
    headgeom.setMaterial(math);
    headgeom.center().move(new Vector3f(0, 4.42f, 0));
    res.attachChild(headgeom);

    // create a "nose" to see where robot is heading
    Box nose = new Box(0.2f, 0.2f, 0.2f);
    Geometry nosegeom = new Geometry("head", nose);
    Material matn = mat.clone();
    matn.setColor("Color", ColorRGBA.Orange);
    matn.setColor("GlowColor", ColorRGBA.Orange);
    nosegeom.setMaterial(matn);
    nosegeom.center().move(new Vector3f(0, 4.42f, 1.5f));
    res.attachChild(nosegeom);

    return res;
}
 
开发者ID:mifth,项目名称:JME-Simple-Examples,代码行数:50,代码来源:Main.java


示例18: simpleInitApp

import com.jme3.scene.shape.Cylinder; //导入依赖的package包/类
@Override
  public void simpleInitApp() {
    assetManager.registerLocator("inmoov/jm3/assets", FileLocator.class);
    Material mat = new Material(assetManager,"Common/MatDefs/Misc/Unshaded.j3md");
    mat.setColor("Color", ColorRGBA.Green);
    viewPort.setBackgroundColor(ColorRGBA.Gray);
    inputManager.setCursorVisible(true);
    flyCam.setEnabled(false);
    Node node = new Node("cam");
    node.setLocalTranslation(0, 300, 0);
    rootNode.attachChild(node);
//    ChaseCamera chaseCam = new ChaseCamera(cam, node, inputManager);
//    chaseCam.setDefaultDistance(900);
//    chaseCam.setMaxDistance(2000);
//    chaseCam.setDefaultHorizontalRotation((float)Math.toRadians(90));
//    chaseCam.setZoomSensitivity(10);
    DirectionalLight sun = new DirectionalLight();
    sun.setDirection(new Vector3f(-0.1f, -0.7f, -1.0f));
    rootNode.addLight(sun);
    cam.setLocation(new Vector3f(0f,0f,900f));
    rootNode.scale(.40f);
    rootNode.setLocalTranslation(0, -200, 0);
    Cylinder c= new Cylinder(8,50,5,10,true,false);
    Geometry geom = new Geometry("Cylinder",c);
    geom.setMaterial(mat);
    point = new Node("point");
    point.attachChild(geom);
    rootNode.attachChild(point);
    ready = true;
    synchronized (service) {
      if (service!= null){
        service.notifyAll();
      }
    }
    inputManager.addMapping("MouseClickL", new MouseButtonTrigger(MouseInput.BUTTON_LEFT));
    inputManager.addListener(analogListener, "MouseClickL");
    inputManager.addMapping("MouseClickR", new MouseButtonTrigger(MouseInput.BUTTON_RIGHT));
    inputManager.addListener(analogListener, "MouseClickR");
    inputManager.addMapping("MMouseUp", new MouseAxisTrigger(MouseInput.AXIS_WHEEL,false));
    inputManager.addListener(analogListener, "MMouseUp");
    inputManager.addMapping("MMouseDown", new MouseAxisTrigger(MouseInput.AXIS_WHEEL,true));
    inputManager.addListener(analogListener, "MMouseDown");
    inputManager.addMapping("Left",  new KeyTrigger(KeyInput.KEY_A),
        new KeyTrigger(KeyInput.KEY_LEFT)); // A and left arrow
    inputManager.addMapping("Right", new KeyTrigger(KeyInput.KEY_D),
        new KeyTrigger(KeyInput.KEY_RIGHT)); // D and right arrow    
    inputManager.addMapping("Up",  new KeyTrigger(KeyInput.KEY_W),
        new KeyTrigger(KeyInput.KEY_UP)); // A and left arrow
    inputManager.addMapping("Down", new KeyTrigger(KeyInput.KEY_S),
        new KeyTrigger(KeyInput.KEY_DOWN)); // D and right arrow    
    inputManager.addListener(analogListener, new String[]{"Left","Right","Up","Down"});
}
 
开发者ID:MyRobotLab,项目名称:myrobotlab,代码行数:53,代码来源:TestJmeIMModel.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Timestamp类代码示例发布时间:2022-05-21
下一篇:
Java ContainerServlet类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap