Model getting Angular translation

Anything libgdx related goes here!

Model getting Angular translation

Postby JKumar » Fri Aug 13, 2010 12:55 pm

HI,

I have an obj file and after rendering, when i am trying to translate it, its getting an angular translation rather than a serial translation.

Please suggest the solution.
JKumar
 
Posts: 13
Joined: Tue Jul 20, 2010 11:08 am

Re: Model getting Angular translation

Postby mzechner » Fri Aug 13, 2010 3:17 pm

Hi,

i'm not quiet sure what you mean by angular translation. Do you mean the model rotates instead of translating (== moving by some vector)? In that case please post the code you use for rendering and manipulating the various OpenGL matrix stacks (e.g. glTranslate, glRotate etc.).

I am currently renovating my flat so i might not answer before sunday or monday. Sorry for that delay :(

ciao,
Mario
mzechner
Site Admin
 
Posts: 4593
Joined: Sat Jul 10, 2010 3:50 pm

Re: Model getting Angular translation

Postby JKumar » Mon Aug 16, 2010 5:36 am

Hi,

Yes. the obj is getting rotated. I am attaching the code files in which Game file is the main and others are supporting files only.
Attachments
Code Files.zip
(2.87 KiB) Downloaded 98 times
JKumar
 
Posts: 13
Joined: Tue Jul 20, 2010 11:08 am

Re: Model getting Angular translation

Postby mzechner » Mon Aug 16, 2010 1:21 pm

Hi,

could you please post your model files too?

ciao,
Mario
mzechner
Site Admin
 
Posts: 4593
Joined: Sat Jul 10, 2010 3:50 pm

Re: Model getting Angular translation

Postby JKumar » Tue Aug 17, 2010 11:42 am

HI,

The site is not allowing to upload obj files.
JKumar
 
Posts: 13
Joined: Tue Jul 20, 2010 11:08 am

Re: Model getting Angular translation

Postby mzechner » Tue Aug 17, 2010 11:53 pm

either zip them or go to http://www.file-pasta.com and upload them there.
mzechner
Site Admin
 
Posts: 4593
Joined: Sat Jul 10, 2010 3:50 pm

Re: Model getting Angular translation

Postby JKumar » Wed Aug 18, 2010 8:04 am

HI,

I have uploaded the file to http://www.file-pasta.com/?f=Models.zip ... Models.zip .

Please suggest a solution. I am also finding difficulty in using animation from the files.
JKumar
 
Posts: 13
Joined: Tue Jul 20, 2010 11:08 am

Re: Model getting Angular translation

Postby mzechner » Wed Aug 18, 2010 12:16 pm

Your ModelManager uses constants defined in MODELS to load the obj files. The files should be named 0.obj, 1.obj etc. The files you uploaded are called model.obj, model0.obj.

The obj files are HUGE. There's no chance that this will run on an Android device with acceptable performance.

The obj file format does not support key frame or skeletal animation i'm afraid.

The way you load the obj files will not work. You specify using fixed point floats which throws an exception due to the second model being so huge. I have no idea how you could have run this on the desktop. Also, i'd suggest using floating point instead of fixed point. There's no real benefit using floats on any android device.

Your camera is looking along the negativ x-axis (line 37 in Game.java). Are you sure that's what you want? I can see how this is confusing when performing a translation via the 0-5 keys as you did in Game.java.

So from what i saw: the models load fine (if you use floats instead of fixed point, ModelManager, line 22, last parameter to ModelLoader.loadObj should be true). The positioning works as expected as well as applying translation via glTranslate. Your models are to big for any mobile device. Your camera is looking along the negative x-axis instead of the more standard negative z-axis for testing purposes which might get you confused.
mzechner
Site Admin
 
Posts: 4593
Joined: Sat Jul 10, 2010 3:50 pm


Return to Libgdx

Who is online

Users browsing this forum: Bing [Bot], Google [Bot], Paulica, schmidt9 and 6 guests

cron

x