A little help with a Solar System!

So ok, im making a solar system for a project in class and i have currently almosteverything down, the planets themselves, the rotation of the planets around the sun, thing is, i need to add a function so everytime I click on a planet, that planets goes away (Currently thinking making it dissapear or just make it fly off to the distance) and the rest of them speed up, any idea on how to do it?

I itried using triggers but I cant make it work so yeah, a lot of name variables are in Spanish so ill just comment what they are

Heres the code

package mygame;

import com.jme3.app.SimpleApplication;
import com.jme3.input.MouseInput;
import com.jme3.input.controls.ActionListener;
import com.jme3.input.controls.KeyTrigger;
import com.jme3.input.controls.Trigger;
import com.jme3.material.Material;
import com.jme3.math.ColorRGBA;
import com.jme3.math.FastMath;
import com.jme3.math.Vector3f;
import com.jme3.renderer.RenderManager;
import com.jme3.scene.Geometry;
import com.jme3.scene.shape.Sphere;


public class SistemaSolar extends SimpleApplication {
    
    private final static Trigger lanzarTrigger = new KeyTrigger(MouseInput.BUTTON_LEFT);
    private final static String lanzarNombre = "Lanzar";
    
   
    public double angulo, angulo2, angulo3, angulo4, angulo5, angulo6, angulo7, angulo8, angulo9= 0; //Variables for the angles 
        Sphere sol = new Sphere(32, 32, 5f);
        Geometry geom = new Geometry("Sphere", sol);
        
        Sphere mercurio = new Sphere(32, 32, 1f);
        Geometry geom2 = new Geometry("Sphere", mercurio);
        
        Sphere venus = new Sphere(32, 32, 2.2f);
        Geometry geom3 = new Geometry("Sphere", venus);
        
        Sphere tierra = new Sphere(32, 32, 2.2f);
        Geometry geom4 = new Geometry("Sphere", tierra);
        
        Sphere marte = new Sphere(32, 32, 1.5f);
        Geometry geom5 = new Geometry("Sphere", marte);
        
        Sphere jupiter = new Sphere(32, 32, 4f);
        Geometry geom6 = new Geometry("Sphere", jupiter);
        
        Sphere saturno = new Sphere(32, 32, 3f);
        Geometry geom7 = new Geometry("Sphere", saturno);
        
        Sphere urano = new Sphere(32, 32, 2f);
        Geometry geom8 = new Geometry("Sphere", urano);
        
        Sphere neptuno = new Sphere(32, 32, 2f);
        Geometry geom9 = new Geometry("Sphere", neptuno);
        
        Sphere pluton = new Sphere(32, 32, 1.0f);
        Geometry geom10 = new Geometry("Sphere", pluton);
       
        Vector3f sol1= new Vector3f(0.0f, 1.0f, 1.0f);
        Vector3f mercurio1 = new Vector3f(1.0f, 10.0f, 10.0f);
        Vector3f venus1= new Vector3f(20.0f, 1.0f, 1.0f);
        Vector3f tierra1 = new Vector3f(11.0f, 1.0f, 1.0f);
        Vector3f marte1 = new Vector3f(14.0f, 1.0f, 1.0f);
        Vector3f jupiter1 = new Vector3f(17.0f, 1.0f, 1.0f);
        Vector3f saturno1 = new Vector3f(20.0f, 1.0f, 1.0f);
        Vector3f urano1 = new Vector3f(23f, 1.0f, 1.0f);
        Vector3f neptuno1 = new Vector3f(26f, 1.0f, 1.0f);
        Vector3f pluton1 = new Vector3f(29f, 1.0f, 1.0f);
        Vector3f camera = new Vector3f(0f, 0f, 125f);
    @Override
    public void simpleInitApp() {
        
        
        
        flyCam.setEnabled(true);
        flyCam.setDragToRotate(true);
        inputManager.setCursorVisible(true);
        inputManager.addMapping(lanzarNombre, lanzarTrigger);
        inputManager.addListener(actionListener, new String[]{lanzarNombre});
      
        cam.setLocation(camera);
        
        Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
        Material mat2 = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
        Material mat3 = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
        Material mat4 = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
        Material mat5 = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
        Material mat6 = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
        Material mat7 = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
        Material mat8 = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
        Material mat9 = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
        Material mat10 = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
        
        mat.setColor("Color", ColorRGBA.Yellow);
        mat2.setColor("Color", ColorRGBA.Blue);
        mat3.setColor("Color", ColorRGBA.Red);
        mat4.setColor("Color", ColorRGBA.Green);
        mat5.setColor("Color", ColorRGBA.White);
        mat6.setColor("Color", ColorRGBA.Brown);
        mat7.setColor("Color", ColorRGBA.Cyan);
        mat8.setColor("Color", ColorRGBA.Gray);
        mat9.setColor("Color", ColorRGBA.LightGray);
        mat10.setColor("Color", ColorRGBA.Pink);
                
        
        geom.setMaterial(mat);
        geom2.setMaterial(mat2);
        geom3.setMaterial(mat3);
        geom4.setMaterial(mat4);
        geom5.setMaterial(mat5);
        geom6.setMaterial(mat6);
        geom7.setMaterial(mat7);
        geom8.setMaterial(mat8);
        geom9.setMaterial(mat9);
        geom10.setMaterial(mat10);
        
        
        
        rootNode.attachChild(geom);
        rootNode.attachChild(geom2);
        rootNode.attachChild(geom3);
        rootNode.attachChild(geom4);
        rootNode.attachChild(geom5);
        rootNode.attachChild(geom6);
        rootNode.attachChild(geom7);
        rootNode.attachChild(geom8);
        rootNode.attachChild(geom9);
        rootNode.attachChild(geom10);
        
    }
    
    private ActionListener actionListener = new ActionListener() {
        public void onAction(String name, boolean isPressed, float tpf) {
            System.out.println("Mapping detected (discrete): " + name);
            if (name.equals(lanzarNombre) && !isPressed) {
                geom.setLocalTranslation(1f, 0, 0);
                
                           } 
        }
    };

    @Override
    public void simpleUpdate(float tpf) {
        
        angulo = angulo + 0.04;
        angulo2 = angulo2 + 0.02;
        angulo3 = angulo3 + 0.015;
        angulo4 = angulo4 + 0.0097;
        angulo5 = angulo5 + 0.0085;
        angulo6 = angulo6 + 0.0080;
        angulo7 = angulo7 + 0.007;
        angulo8 = angulo8 + 0.0065;
        angulo9 = angulo9 + 0.0050;
        
        
        float r = FastMath.DEG_TO_RAD;
        double Merc = FastMath.DEG_TO_RAD*angulo;
        double Ven = FastMath.DEG_TO_RAD*angulo2;
        double Tier = FastMath.DEG_TO_RAD*angulo3;
        double Marte = FastMath.DEG_TO_RAD*angulo4;
        double Jupi = FastMath.DEG_TO_RAD*angulo5;
        double Satur = FastMath.DEG_TO_RAD*angulo6;
        double Uran = FastMath.DEG_TO_RAD*angulo7;
        double Neptu = FastMath.DEG_TO_RAD*angulo8;
        double Pluton = FastMath.DEG_TO_RAD*angulo9;
        
        //Position of the planets in the space
        
        int rMer = 7;
        int rVenus = 12;
        int rTierra = 17;
        int rMarte = 22;
        int rJupiter = 32;
        int rSaturno = 40;
        int rUrano = 44;
        int rNeptuno = 48;
        int rPluton = 52;
        
        
        //Coordinates to make the planets go around the sun
        
        float xMer = (float) Math.sin(Merc)*rMer;
        float yMer = (float) Math.cos(Merc)*rMer;
        
        float xVenus = (float) Math.sin(Ven)*rVenus;
        float yVenus = (float) Math.cos(Ven)*rVenus;
        
        float xTierra = (float) Math.sin(Tier)*rTierra;
        float yTierra = (float) Math.cos(Tier)*rTierra;
        
        float xMarte = (float) Math.sin(Marte)*rMarte;
        float yMarte = (float) Math.cos(Marte)*rMarte;
        
        float xJupiter = (float) Math.sin(Jupi)*rJupiter;
        float yJupiter = (float) Math.cos(Jupi)*rJupiter;
        
        float xSaturno = (float) Math.sin(Satur)*rSaturno;
        float ySaturno = (float) Math.cos(Satur)*rSaturno;
        
        float xUrano = (float) Math.sin(Uran)*rUrano;
        float yUrano = (float) Math.cos(Uran)*rUrano;
        
        float xNeptuno = (float) Math.sin(Neptu)*rNeptuno;
        float yNeptuno = (float) Math.cos(Neptu)*rNeptuno;
        
        float xPluton = (float) Math.sin(Pluton)*rPluton;
        float yPluton = (float) Math.cos(Pluton)*rPluton;
        
         
        
        geom.rotate(r,0f,0f);
        geom2.rotate(r,0f,0f);
        geom3.rotate(r,0f,0f);
        geom4.rotate(r,0f,0f);
        geom5.rotate(r,0f,0f);
        geom6.rotate(r,0f,0f);
        geom7.rotate(r,0f,0f);
        geom8.rotate(r,0f,0f);
        geom9.rotate(r,0f,0f);
        geom10.rotate(r,0f,0f);
        
        //Rotation against the sun
        
        Vector3f orbMercurio = new Vector3f (xMer , yMer, 0);
        Vector3f orbVenus = new Vector3f (xVenus , yVenus, 0);
        Vector3f orbTierra = new Vector3f (xTierra , yTierra, 0);
        Vector3f orbMarte = new Vector3f (xMarte , yMarte, 0);
        Vector3f orbJupiter = new Vector3f (xJupiter , yJupiter, 0);
        Vector3f orbSaturno = new Vector3f (xSaturno , ySaturno, 0);
        Vector3f orbUrano = new Vector3f (xUrano , yUrano, 0);
        Vector3f orbNeptuno = new Vector3f (xNeptuno , yNeptuno, 0);
        Vector3f orbPluton = new Vector3f (xPluton , yPluton, 0);
        
        geom2.setLocalTranslation(orbMercurio);
        geom3.setLocalTranslation(orbVenus);
        geom4.setLocalTranslation(orbTierra);
        geom5.setLocalTranslation(orbMarte);
        geom6.setLocalTranslation(orbJupiter);
        geom7.setLocalTranslation(orbSaturno);
        geom8.setLocalTranslation(orbUrano);
        geom9.setLocalTranslation(orbNeptuno);
        geom10.setLocalTranslation(orbPluton);
        
        }
    
   

       
   

    @Override
    public void simpleRender(RenderManager rm) {
        //TODO: add render code
    }
    
    public static void main(String[] args) {
        SistemaSolar app = new SistemaSolar();
        app.start();
    }
}

https://wiki.jmonkeyengine.org/jme3/advanced/spatial.html#what-is-culling

Is it making them clickable that is the issue? Or what to do when you click?

Lemur’s picking support makes clicking on things pretty easy.

…but then when you get something clicked on you need to decide what to do. Setting culling off is one way to deal with it. Note that the item will still be pickable, though.

wow ok, that’ll be very helpfull! Ty very much

In the code that i used the idea was that when u click the object would start moving in x 1.0 at a time, but that clearly didnt work

Hey i just had to make another account cus i capped on comments lol
Im trying to use Lemur but the imports won’t work, any idea on where can i get the libraries?

You can get the snippet for Gradle or Maven from

Or you can look at the getting started page if you aren’t using gradle. (or even if you are)

Ok soooo, I just looked it up and managed to install the Lemur libraries, I downloaded the entire project from your github and tried to use the code in geoms to do the click thing and the imports don’t work :frowning:

The Lemur Gems in the Lemur repo have not been converted to gradle. But they can be copied into any gradle project or any project with proper dependencies and they will work fine, presuming the packages are named correctly, etc…

Edit: the lemur demo may use picking as well.

But in general, to use picking is pretty easy. Just use the MouseEventControl or CursorEventControl to register a listener with your spatial. And in your apps initialize, either GuiGlobals.initialize() or add the MouseAppState to your state manager (GuiGlobals.initialize() does that for you.)