object pivot

Started by Thomas., July 26, 2011, 08:04:49 PM

Previous topic - Next topic

Thomas.

I set the object's pivot in 3ds max and when I rotate object in engine pivot is in the center of this object... Is it normal?

EgonOlsen

The loader doesn't care for any pivot set in 3ds Max.

Thomas.

I see, so could you implement this, please? :)

EgonOlsen

Rather not. The rotation pivot is calculated by jPCT when calling build(). Getting it from the file instead would break every application that loads 3ds files.

Thomas.

and what Config.keepOriginalPivot(boolean keep) ... default false

EgonOlsen

If you can send me a 3ds file with pivot and the pivot value itself, i'll look at it...

Thomas.

here is 3ds file http://dl.dropbox.com/u/26148874/object.3DS and position of pivot is 0,0,0 ... thank :)

EgonOlsen

Don't you have anything with a pivot unlike 0,0,0? 0,0,0 is rather...pointless.

Thomas.

file updated with new pivot in 2.699, 1.206, 2.525

EgonOlsen

Oh, the joys of the 3ds format. One could expect that the pivot is part of the object defition, right? Like the camera is, for example (which i don't understand either). No, my friend...why should it? It's part of the keyframe definitions, which contain a tree that orders the objects. This tree references the objects by name (so the names are stored at least twice in the file) and as a sub-chunk, there's a hardly documented bunch of floats (8 to be exact) where the last 3 float seem to contain the pivot. The first 5 ones contain...something...nobody knows. At least that's what i'm guessing and it seems to be correct for your test file. So get this jar: http://jpct.de/download/beta/jpct_ae.jar, set Config.useRotationPivotFrom3DS=true; and see what happens...

Thomas.

#10
Thank you :) I'll try it tomorrow. Now I'm tired a lot because I was a bike ride with my girlfriend...
edit: 3ds has been proposed by some drunks?  ;D

EgonOlsen

Just like .OBJ. I think it's that way for historical reasons. They might have added that tree/name/keyframe/pivot later and couldn't fit it into the actual object-chunks because that would break some third-party software...but that's just a guess.

Thomas.

So, I just tested pivot from 3ds file and ... working without problem, excellent work ;)

nico_r_a

i try to turn an object, and i load 3 object in 3ds (i think the problem is to define each object)
but in my log cat i have this

08-04 10:15:41.234: WARN/dalvikvm(395): threadid=9: thread exiting with uncaught exception (group=0x40014760)
08-04 10:15:41.234: ERROR/AndroidRuntime(395): FATAL EXCEPTION: GLThread 10
08-04 10:15:41.234: ERROR/AndroidRuntime(395): java.lang.NullPointerException
08-04 10:15:41.234: ERROR/AndroidRuntime(395):     at com.mm.Ovip$MyRenderer.onSurfaceChanged(Ovip.java:359)
08-04 10:15:41.234: ERROR/AndroidRuntime(395):     at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1422)
08-04 10:15:41.234: ERROR/AndroidRuntime(395):     at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1184)
08-04 10:15:41.285: WARN/ActivityManager(81):   Force finishing activity com.mm/.Ovip
08-04 10:15:41.297: WARN/WindowManager(81): Failure taking screenshot for (230x135) to layer 21015

EgonOlsen

The nullpointer is in your code, not in the engine. I can't comment on that without seeing the code.