Package com.jme3.scene

Examples of com.jme3.scene.Spatial


    loadCharacter(event.getSelectedId());
  }

  private void loadCharacter(String id) {
    Node characterNode = new Node("character");
    Spatial character = app.getAssetManager().loadModel("character/" + id + "/Mesh.mesh.xml");
    character.setLocalTranslation(0f, 0f, 5f);
    Material mat_character = new Material(app.getAssetManager(), "Common/MatDefs/Light/Lighting.j3md");
    mat_character.setTexture("DiffuseMap", app.getAssetManager().loadTexture("character/male/male.png"));
    character.setMaterial(mat_character);
    Quaternion rotate = new Quaternion();
    rotate.fromAngleAxis(-FastMath.PI / 2, new Vector3f(1, 0, 0));
    character.setLocalRotation(rotate);
    characterNode.attachChild(character);
    app.getRootNode().attachChild(characterNode);

    System.out.println(cam.getDirection());
  }
View Full Code Here


  }
 
  private void setUpEnvironment()  {
    rootNode.attachChild(SkyBoxFactory.createSimpleSkyBox(assetManager));

    Spatial asteroid = assetManager.loadModel("spaceobject/asteroid/dusty/Asteroid.mesh.xml");
    asteroid.setLocalTranslation(0f, 0f, 20f);
    Material mat_asteroid = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
    mat_asteroid.setTexture("ColorMap", assetManager.loadTexture("spaceobject/asteroid/dusty/asteroidtextur_512.jpg"));
    asteroid.setMaterial(mat_asteroid);
    rootNode.attachChild(asteroid);
   
   
    debugGUI = new DebugGUI(this);
  }
View Full Code Here

 
 
  public static void traverseAndMirror(int axis, Queue<Spatial> queue){
   
    if(!queue.isEmpty()){
      Spatial node = queue.remove();
     
      if(node instanceof Geometry)
        mirrorAlong(axis, (Geometry)node);
      else
        queue.addAll(((Node)node).getChildren());
View Full Code Here

        bulletAppState.getPhysicsSpace().add(opponent.playerc);
        //Todo
    }
    public void addScene(){
        assetManager.registerLocator("town.zip", ZipLocator.class);
        Spatial underground = assetManager.loadModel("main.scene");
        underground.setLocalScale(2f);
        scene.attachChild(underground);
        CollisionShape sceneShape =
            CollisionShapeFactory.createMeshShape(scene);
        RigidBodyControl landscape;
        landscape = new RigidBodyControl(sceneShape, 0);
View Full Code Here

    int life = 1000;
    int llife = 1000;
    public Player(Node rootNode, AssetManager assetManager, Vector3f position)
    {
        player = new Node();
        Spatial playerBody = assetManager.loadModel("Models/untitled2.obj");
       
        Material mat_player = new Material(
            assetManager, "Common/MatDefs/Misc/ColoredTextured.j3md");  
        mat_player.setTexture("ColorMap", assetManager.loadTexture("Textures/WOOOOW.jpg"));
        playerBody.setMaterial(mat_player);
        playerBody.setName("body");
        player.attachChild(playerBody);
        CapsuleCollisionShape capsuleShape = new CapsuleCollisionShape(1.5f, 6f, 1);
        playerc = new CharacterControl(capsuleShape, 0.05f);
        playerc.setJumpSpeed(20);
        playerc.setFallSpeed(30);
View Full Code Here

  }

  public void show(WorldObject obj) {
    if (obj instanceof VisibleObject) {
      VisibleObject vo = (VisibleObject)obj;
      Spatial vos = vo.getSpatial();
      if (vos != null)
        rootNode.attachChild(vos);
      Light vol = vo.getLight();
      if (vol != null)
        rootNode.addLight(vol);
View Full Code Here

  }

  public void hide(WorldObject obj) {
    if (obj instanceof VisibleObject) {
      VisibleObject vo = (VisibleObject)obj;
      Spatial vos = vo.getSpatial();
      if (vos != null)
        rootNode.detachChild(vos);
      Light vol = vo.getLight();
      if (vol != null)
        rootNode.removeLight(vol);
View Full Code Here

    }

    @Override
    public int detachChildNamed(String childName) {
        for (int x = 0, max = children.size(); x < max; x++) {
            Spatial child = children.get(x);
            if (childName.equals(child.getName())) {
                notifyListeners(new NodeChangedEvent(this, child, EventType.DETACHED));
                detachChildAt(x);
                if (child instanceof ScenegraphNode)
                    ((ScenegraphNode) child).setScenegraph(null);
                return x;
View Full Code Here

        return -1;
    }

    @Override
    public Spatial detachChildAt(int index) {
        Spatial child = children.get(index);
        if (hasChild(child))
            notifyListeners(new NodeChangedEvent(this, child, EventType.DETACHED));
        super.detachChildAt(index);
        if (child instanceof ScenegraphNode)
            ((ScenegraphNode) child).setScenegraph(null);
View Full Code Here

        app.start();
    }

    @Override
    public void simpleInitApp() {
        Box b = new Box(Vector3f.ZERO, 1, 1, 1);
        Geometry geom = new Geometry("Box", b);
        geom.updateModelBound();

        Material mat = new Material(assetManager, "Common/MatDefs/Misc/SolidColor.j3md");
        mat.setColor("m_Color", ColorRGBA.Blue);
View Full Code Here

TOP

Related Classes of com.jme3.scene.Spatial

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.