Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

JAVA3d help

  1. Jul 9, 2010 #1
    Ok, so I need a hand with using loaders. I want to know where to put a loader file if I want to use it in JAVA 3d. this will be my first program in Java3d. I am relatively new to in depth java, and have a lot of modeling experience. If I can load my models into the J3d enviornment, it will make it way easier for me to teach myself because I can manipulate my own models.

    With that said, I only need the following answered-

    Once I install JAVA3d, it installs in a seperate folder than the JDK I am currently working with. Are those libraries automatically reconized by my JDK, or do I have to do soem work and reference it's location somewhere in my tools (I'm using EDITPLUS 3).

    Where do I put my Loader? I am using the milkshape "MS3DLoader-1.0.8.jar" loader.

    Also, I have the code here, but the thing is, I'm not 100% sure where to put in the name of my model, "BOB". I think its at the bottom, where it says "raptor.ms3d". the model will currently be in the same folder as the class we are programming here.


    import com.sun.j3d.loaders.*;
    import com.glyphein.j3d.loaders.milkshape.MS3DLoader;

    Loader loader = new MS3DLoader(MS3DLoader.LOAD_ALL);

    Loading a model from a URL:

    com.sun.j3d.loaders.Scene scene = loader.load(url);
    BranchGroup group = scene.getSceneGroup();

    Loading a model from a file:

    java.io.File file = new java.io.File("raptor.ms3d");
    if (file.getParent().length() > 0) // figure out the base path
    loader.setBasePath(file.getParent() + java.io.File.separator);
    Scene scene = loader.load(file.getName());
    BranchGroup group = scene.getSceneGroup();
  2. jcsd
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Can you offer guidance or do you also need help?
Draft saved Draft deleted

Similar Threads - JAVA3d help Date
C/++/# Help with MATLAB code? Feb 9, 2018
What's wrong with my bisection method code? Dec 10, 2017
Java3D graphics Nov 23, 2012
Java3D graphics: solid line looks dashed Aug 19, 2012
JAVA3D Loader Help Jul 6, 2010