Good vs. Evil

  • FTB will be shutting down this forum by the end of July. To participate in our community discussions, please join our Discord! https://ftb.team/discord

lenscas

Over-Achiever
Jul 31, 2013
2,015
1,801
248
90
Code:
package jme3test.helloworld;
import com.jme3.app.SimpleApplication;
import com.jme3.material.Material;
import com.jme3.math.ColorRGBA;
import com.jme3.math.Vector3f;
import com.jme3.scene.Geometry;
import com.jme3.scene.Node;
import com.jme3.scene.shape.Box;
/** Sample 4 - how to trigger repeating actions from the main event loop.
 * In this example, you use the loop to make the player character
 * rotate continuously. */
public class HelloLoop extends SimpleApplication {
  public static void main(String[] args){
  HelloLoop app = new HelloLoop();
  app.start();
  }
  protected Geometry player;
  protected Geometry player2;
  protected Node pivot;
  protected Material matb;
  protected Material mat;
   
  @Override
  public void simpleInitApp() {
  /** this blue box is our player character */
  Box b = new Box(1, 1, 1);
  player = new Geometry("blue cube", b);
  player.setLocalTranslation(new Vector3f(1,-1,1));
  mat = new Material(assetManager,
  "Common/MatDefs/Misc/Unshaded.j3md");
  mat.setColor("Color", ColorRGBA.Blue);
  player.setMaterial(mat);
  rootNode.attachChild(player);
   
  Box c = new Box(1, 1, 1);
  player2 = new Geometry("red cube", c);
  player2.setLocalTranslation(new Vector3f(1,3,1));
  matb = new Material(assetManager,
  "Common/MatDefs/Misc/Unshaded.j3md");
  matb.setColor("Color", ColorRGBA.Red);
  player2.setMaterial(mat);
  rootNode.attachChild(player2);
   
  pivot = new Node("pivot");
  rootNode.attachChild(pivot); // put this node in the scene
  /** Attach the two boxes to the *pivot* node. (And transitively to the root node.) */
  pivot.attachChild(player);
  pivot.attachChild(player2);
  /** Rotate the pivot node: Note that both boxes have rotated! */
  // pivot.rotate(.4f,.4f,0f);
  }
  /* Use the main event loop to trigger repeating actions. */
  @Override
  public void simpleUpdate(float tpf) {
  //make the player rotate:
  player.rotate(0, 2*tpf, 0);
  player2.rotate(0, -4*tpf, 0);
  pivot.move(0, 2*tpf, 0);
  pivot.rotate(1*tpf, 1*tpf,0);
   
  }
}
 

lenscas

Over-Achiever
Jul 31, 2013
2,015
1,801
248
92 sort off......
right now just looking at the jmonkeyengine (which I keep calling jmonkeycodeengine for a sad reason).

also, when I installed the ide on debian I was shocked and had no idea what to do (it asked me for an install path.) :p