• Invisible(?) render issues in Java?
    6 replies, posted
As some of you have recently seen, i've been working on an engine called Lund (or Lünd), and it's been going relatively fine. There has been one thing however, that has stumped me completely. I have a command (spawnitem) that creates an item in the world, and it just refuses to work, with no errors at all. The spawnitem command is defined in [URL=http://code.google.com/p/lund-client/source/browse/trunk/src/client/consoleCommand.java]this[/url], like this: [CODE] private class spawnItem implements ConsoleCommand { @Override public void execute(final String[] args) { if(args.length < 2 || args.length > 2) { Main.api.gi.niftyConsoleC.output("Incorrect parameters, needs spawnitem id"); } else { object_item.item_base.spawn_item(Integer.parseInt(args[1])); } } } [/CODE] It calls the object_item spawn_item function, defined [URL=http://code.google.com/p/lund-client/source/browse/trunk/src/client/object_item.java]here[/url], like this: [CODE] public static void spawn_item(int id) { Main.api.gi.niftyConsoleC.output("Spawning item: " + Integer.toString(id)); broken_icon = Main.api.getAssetManager().loadTexture("Textures/icon_unknown.png"); Node temp = new Node(); icon = getIcon(id); Main.api.gi.niftyConsoleC.output("Got icon: " + icon.getName()); skin = getTexture(id); Main.api.gi.niftyConsoleC.output("Got skin: " + skin.getName()); physi = getPhys(id); Main.api.gi.niftyConsoleC.output("Got Physical: " + physi); model = getModel(id); Main.api.gi.niftyConsoleC.output("Got Model: " + model.getName()); temp.setName(Integer.toString(id) + model.toString()); temp.attachChild(model); Material mat = new Material(Main.api.getAssetManager(),"Common/MatDefs/Light/Lighting.j3md"); mat.setTexture("DiffuseMap", skin); mat.setColor("m_Specular", ColorRGBA.White); mat.setFloat("m_Shininess", 3); model.setMaterial(mat); temp.setLocalTranslation(Main.api.play.getLocation()); if(physi) { Main.api.gi.niftyConsoleC.output("Item set as physical."); HullCollisionShape hull = new HullCollisionShape(); RigidBodyControl cont = new RigidBodyControl(hull,2f); temp.addControl(cont); } else { Main.api.gi.niftyConsoleC.output("Item set as dynamic."); HullCollisionShape hull = new HullCollisionShape(); RigidBodyControl cont = new RigidBodyControl(hull,2f); cont.setKinematic(true); item_animation anim = new item_animation(); anim.do_item_anim(temp); temp.addControl(cont); } File e = new File("Textures/" + icon.getName()); if(e.exists()) { icons.add(icon); } else { icons.add(broken_icon); } //items.set(id, this); Main.api.getRootNode().attachChild(temp); } [/CODE] The in-game console, and the actual console reports no errors, and nothing appears in-game after using the command, and i'm stumped to as what I have missed or done wrong. Help anyone?
why are your lines of code in a table
[QUOTE=supersnail11;35086163]why are your lines of code in a table[/QUOTE] Haven't a clue, I put them in code blocks but it autoformatted them like that... I'll try fix it
Doesn't java have breakpoints?
[QUOTE=Ybbats;35089975]Doesn't java have breakpoints?[/QUOTE] It does, but the problem is that it gets all the way through the spawning and apparently spawns it in world, i've tried debug messages and such and i'm stumped.
If the spawn_item function isn't giving any clues, have you tried debugging to make sure the renderer is actually rendering the items?
I've checked with breakpoints and all, and i've tried debugging the scene, the spawn_item function passes all the correct values, correct texture and skin, not transparent or anything, and it is placed in the scene (when I list all nodes, it shows up). I have absolutely no idea why it wouldn't be rendering..
Sorry, you need to Log In to post a reply to this thread.