Author Topic: object pivot  (Read 6154 times)

Offline Thomas.

  • double
  • *****
  • Posts: 833
    • View Profile
object pivot
« on: July 26, 2011, 08:04:49 pm »
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?

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11776
    • View Profile
    • http://www.jpct.net
Re: object pivot
« Reply #1 on: July 26, 2011, 08:11:16 pm »
The loader doesn't care for any pivot set in 3ds Max.

Offline Thomas.

  • double
  • *****
  • Posts: 833
    • View Profile
Re: object pivot
« Reply #2 on: July 26, 2011, 09:02:05 pm »
I see, so could you implement this, please? :)

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11776
    • View Profile
    • http://www.jpct.net
Re: object pivot
« Reply #3 on: July 27, 2011, 09:18:56 am »
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.

Offline Thomas.

  • double
  • *****
  • Posts: 833
    • View Profile
Re: object pivot
« Reply #4 on: July 27, 2011, 10:08:09 am »
and what Config.keepOriginalPivot(boolean keep) ... default false

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11776
    • View Profile
    • http://www.jpct.net
Re: object pivot
« Reply #5 on: July 27, 2011, 08:47:01 pm »
If you can send me a 3ds file with pivot and the pivot value itself, i'll look at it...

Offline Thomas.

  • double
  • *****
  • Posts: 833
    • View Profile
Re: object pivot
« Reply #6 on: July 27, 2011, 10:08:37 pm »
here is 3ds file http://dl.dropbox.com/u/26148874/object.3DS and position of pivot is 0,0,0 ... thank :)

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11776
    • View Profile
    • http://www.jpct.net
Re: object pivot
« Reply #7 on: July 27, 2011, 11:55:13 pm »
Don't you have anything with a pivot unlike 0,0,0? 0,0,0 is rather...pointless.

Offline Thomas.

  • double
  • *****
  • Posts: 833
    • View Profile
Re: object pivot
« Reply #8 on: July 28, 2011, 02:20:42 am »
file updated with new pivot in 2.699, 1.206, 2.525

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11776
    • View Profile
    • http://www.jpct.net
Re: object pivot
« Reply #9 on: August 02, 2011, 08:53:07 pm »
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...

Offline Thomas.

  • double
  • *****
  • Posts: 833
    • View Profile
Re: object pivot
« Reply #10 on: August 02, 2011, 09:21:25 pm »
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
« Last Edit: August 02, 2011, 09:28:31 pm by Thomas. »

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11776
    • View Profile
    • http://www.jpct.net
Re: object pivot
« Reply #11 on: August 02, 2011, 09:47:21 pm »
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.

Offline Thomas.

  • double
  • *****
  • Posts: 833
    • View Profile
Re: object pivot
« Reply #12 on: August 03, 2011, 09:44:01 pm »
So, I just tested pivot from 3ds file and ... working without problem, excellent work ;)

Offline nico_r_a

  • byte
  • *
  • Posts: 48
    • View Profile
Re: object pivot
« Reply #13 on: August 04, 2011, 12:13:35 pm »
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

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11776
    • View Profile
    • http://www.jpct.net
Re: object pivot
« Reply #14 on: August 04, 2011, 05:42:35 pm »
The nullpointer is in your code, not in the engine. I can't comment on that without seeing the code.