Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (487)
Games in Android Showcase (110)
games submitted by our members
Games in WIP (552)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  ASE Loader & pivot points  (Read 775 times)
0 Members and 1 Guest are viewing this topic.
Offline rmdire

Junior Member





« Posted 2005-12-01 12:19:11 »

HI,

I am having trouble with  rotating around pivot points
I have loaded my model into the scene without problems

like so:

      AseFile af = new AseFile();
      BufferedReader br = null;
      
      try {
         // Attempts to read the file normally
         br = new BufferedReader(new FileReader(path));
      
      } catch (IOException e) {
         // Attemts to read file from JAR
         URL url = this.getClass().getClassLoader().getResource(path);
         try {
            br = new BufferedReader(new InputStreamReader(url.openStream()));
         } catch (IOException e1) {
            // TODO Auto-generated catch block
            e1.printStackTrace();
         }
      }
      
      AseReader r = new AseReader(br, af);
      af.parse(r);
   
      namedNodes = new HashMap ();
      TransformGroup rootTG = af.getTransformGroupTree(namedNodes);
      Transform3D transform = new Transform3D();
      transform=rootTG.getTransform();
      Transform3D myRot = new Transform3D();
      myRot.rotY((float)Math.toRadians(180));
      transform.mul(myRot);
      rootTG.setTransform(transform);

                        Material mat2 = new Material();
      mat2.setEmissiveColor(0f,0f,1f);
      mat2.setSpecularColor(0.0f,0.0f,0.5f);
      mat2.setAmbientColor(0.0f,0.0f,0.5f);
      mat2.setDiffuseColor(0.0f,0.0f,0.0f);
      mat2.setLightingEnable(true);   
      
      // Recursivly applies material to root BG
      addMaterial(rootTG, mat2);


and I can access each part using :

      TransformGroup backLeftLeg = (TransformGroup) namedNodes.get("Rear Left Leg");
      Transform3D trans = backLeftLeg.getTransform();

But when I try to rotate using:

                                           trans.rotZ(tate);
      backLeftLeg.setTransform(trans);

the backLeftLeg rotates around a point somewhere below the foot (possibly 0,0,0)

The model is set at 0,0,0
and I have set my pivot points using 3Ds max 7 and saved the file using the helper options etc. as described in the tutorial

I also opened the ASE file to check that all the pivot points had been set - and they appear to be set at the right points

any ideas why this strange rotation is happening?

Cheers

Rmdire
      
Offline rmdire

Junior Member





« Reply #1 - Posted 2005-12-02 09:35:53 »

Still no Joy,

Just wondered does anybody have an example .ASE model that I can look at and see if I can spot the difference

Cheers

Rmdire
Offline William Denniss

JGO Coder


Projects: 2


Fire at will


« Reply #2 - Posted 2005-12-03 08:41:37 »

have you looked at the example that came with the tutorial?

Try loading up the "human-orig.max" file from the tutorial, exporting and see if it works.  If it does then the problem lies elsewhere (i.e. your model or your code), if it doesn't then your exporting isn't working properly.

I have not yet tried with MAX 7, perhaps that is the issue (can you try with MAX6?)

If looking at the ASE file, TM_POS is the Pivot node (IIRC).

Cheers,

Will.

Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

CopyableCougar4 (23 views)
2014-08-22 19:31:30

atombrot (34 views)
2014-08-19 09:29:53

Tekkerue (30 views)
2014-08-16 06:45:27

Tekkerue (28 views)
2014-08-16 06:22:17

Tekkerue (18 views)
2014-08-16 06:20:21

Tekkerue (27 views)
2014-08-16 06:12:11

Rayexar (65 views)
2014-08-11 02:49:23

BurntPizza (41 views)
2014-08-09 21:09:32

BurntPizza (31 views)
2014-08-08 02:01:56

Norakomi (42 views)
2014-08-06 19:49:38
List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06

List of Learning Resources
by SilverTiger
2014-07-31 11:54:12

HotSpot Options
by dleskov
2014-07-08 01:59:08
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!