private void initTerrain() { worldMap = tb.initTerrain(display); // worldMap.setCullMode(CULL_MODE.NEVER); // worldMap.updateLocalBound(); // worldMap.setShowBound(true); groundPlaneP = physicsEngine.addStaticPlaneObject( physicsEngine.nextUID(), worldMap.getWorldTransform().getValues(), up, 12.0f); groundPlaneP.setBounciness(1.0f); worldMap.setPhysicsObject(groundPlaneP); addGameWorldObject(worldMap); }
private void initPlayers() { File file = new File(File.pathSeparator); System.out.println(file.getAbsolutePath()); OgreXMLParser loader = new OgreXMLParser(); try { model = loader.loadModel( "src/animated_objects/Cube.mesh.xml", "src/animated_objects/chicken.material", "src/animated_objects/Cube.skeleton.xml"); model.updateGeometricState(0, true); java.util.Iterator<SceneNode> modelIterator = model.iterator(); player1 = (Model3DTriMesh) modelIterator.next(); } catch (Exception e) { e.printStackTrace(); System.exit(1); } Texture chickenTexture = TextureManager.loadTexture2D("src/animated_objects/green_chicken.jpg"); chickenTexture.setApplyMode(sage.texture.Texture.ApplyMode.Replace); chickenTextureState = (TextureState) display.getRenderer().createRenderState(RenderState.RenderStateType.Texture); chickenTextureState.setTexture(chickenTexture, 0); chickenTextureState.setEnabled(true); player1.setRenderState(chickenTextureState); player1.updateRenderStates(); player = physicsEngine.addSphereObject( physicsEngine.nextUID(), ballMass, player1.getWorldTransform().getValues(), 1.0f); player.setBounciness(0.0f); player1.setPhysicsObject(player); player1.scale(.35f, .35f, .35f); addGameWorldObject(player1); // player1.translate(133f, 13f, 123f); playerInitM = new Matrix3D(); playerInitM.concatenate((Matrix3D) player1.getLocalTranslation().clone()); playerInitM.concatenate((Matrix3D) player1.getLocalRotation().clone()); playerInitM.concatenate((Matrix3D) player1.getLocalScale().clone()); camera1 = new JOGLCamera(renderer); camera1.setPerspectiveFrustum(60, 1, 1, 1000); camera1.setViewport(0.0, 1.0, 0.0, 1); }