Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Java3D: how to transform an object loaded with obj loader

Reply
Thread Tools

Java3D: how to transform an object loaded with obj loader

 
 
NickPick
Guest
Posts: n/a
 
      03-03-2010
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());
 
Reply With Quote
 
 
 
 
Jeff Higgins
Guest
Posts: n/a
 
      03-04-2010
NickPick wrote:
> 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


Here's another place to ask for help with the Java 3D related:
<http://forums.java.net/jive/forum.jspa?forumID=70>
 
Reply With Quote
 
 
 
 
blabla
Guest
Posts: n/a
 
      03-05-2010

> 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)?
>
> Transform3D tr = new Transform3D();
> tr.set(new Vector3f(0.3f, 0.2f, 0.2f));



You already translated it by (0.3,0.2,0.2), did you try to change it to
(5,5,5)?


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
Library class loader (setting system class loader parent) Karsten Wutzke Java 0 06-29-2007 04:44 AM
Obj* ptr = new Obj(X) Phil Endecott C++ 5 06-03-2005 10:48 PM
Descriptors: why __get__(obj,typ=None) instead of __get__(obj,typ) Shalabh Chaturvedi Python 2 02-20-2004 08:26 PM
difference between Convert.ToString(obj) and CType(obj, String) Mark Kamoski ASP .Net 3 08-08-2003 11:09 PM



Advertisments