N
NickPick
How can I transform an object which I loaded with a loader as below?
What is the code when I want to move it to (5,5,5)?
thanks
ObjectFile f = new ObjectFile();
Scene loadedShip = null;
try {
loadedShip = f.load("C:/Users/Nicolas/Documents/
NetBeansProjects/3dGame/src/Gamestar/obj.obj");
} catch (FileNotFoundException e) {
System.err.println(e);
System.exit(1);
} catch (ParsingErrorException e) {
System.err.println(e);
System.exit(1);
} catch (IncorrectFormatException e) {
System.err.println(e);
System.exit(1);
}
// set colors
Color3f lColor1 = new Color3f(0.7f, 0.7f, 0.7f);
Vector3f lDir1 = new Vector3f(-1.0f, -1.0f, -1.0f);
Color3f alColor = new Color3f(0.2f, 0.2f, 0.2f);
// set light
AmbientLight aLgt = new AmbientLight(alColor);
BoundingSphere bounds = new BoundingSphere(new Point3d(0.0,
2.0, 0.0), 100.0);
aLgt.setInfluencingBounds(bounds);
DirectionalLight lgt1 = new DirectionalLight(lColor1, lDir1);
lgt1.setInfluencingBounds(bounds);
objRoot.addChild(aLgt);
objRoot.addChild(lgt1);
Transform3D tr = new Transform3D();
tr.set(new Vector3f(0.3f, 0.2f, 0.2f));
objRoot.addChild(loadedShip.getSceneGroup());
What is the code when I want to move it to (5,5,5)?
thanks
ObjectFile f = new ObjectFile();
Scene loadedShip = null;
try {
loadedShip = f.load("C:/Users/Nicolas/Documents/
NetBeansProjects/3dGame/src/Gamestar/obj.obj");
} catch (FileNotFoundException e) {
System.err.println(e);
System.exit(1);
} catch (ParsingErrorException e) {
System.err.println(e);
System.exit(1);
} catch (IncorrectFormatException e) {
System.err.println(e);
System.exit(1);
}
// set colors
Color3f lColor1 = new Color3f(0.7f, 0.7f, 0.7f);
Vector3f lDir1 = new Vector3f(-1.0f, -1.0f, -1.0f);
Color3f alColor = new Color3f(0.2f, 0.2f, 0.2f);
// set light
AmbientLight aLgt = new AmbientLight(alColor);
BoundingSphere bounds = new BoundingSphere(new Point3d(0.0,
2.0, 0.0), 100.0);
aLgt.setInfluencingBounds(bounds);
DirectionalLight lgt1 = new DirectionalLight(lColor1, lDir1);
lgt1.setInfluencingBounds(bounds);
objRoot.addChild(aLgt);
objRoot.addChild(lgt1);
Transform3D tr = new Transform3D();
tr.set(new Vector3f(0.3f, 0.2f, 0.2f));
objRoot.addChild(loadedShip.getSceneGroup());