Hello! So I am trying to design a Rubik’s cube in jMonkey, and I wanted to add a feature to randomize the cube. I made and attached the input manager, and I have a function that looks like
long start = System.currentTimeMillis();
long update = System.currentTimeMillis();
Random rand = new Random();
update = System.currentTimeMillis();
int randNum = rand.nextInt(6)+1;
rotate.onAction("Rotate"+randNum, false, tpf);
angSum = 0;
Where rotate is an ActionListener that handles when a user wants to rotate a specific way “Rotate1”, “Rotate2”, etc. and update is the standard update loop that rotates a side of the cube. When this is run the screen freezes, so is there any way I can update the screen from within this loop? Or is there a better way of achieving randomization?
In a JME application, the update loop is provided for you. Put your update code in an app state or custom control or (in very simple applications) the simpleUpdate() method of the application itself. Otherwise all the other updating (needed to keep your screen from freezing) will never happen.
If you haven’t already, you may want to work your way through the JME tutorials in sequence.
Well, I don’t know where that guy went and I don’t know if he saw my/our reply(ies) but, I finally made my Rubiks Cube app. I had to make a block in Blender (unwrapping a cube), I used my space ship controls for rotations, I figured out how to rotate a 3d matrix that tracks the location of the cubes. So fun!