Author Topic: Behaviour of World.addObject() method  (Read 2499 times)

Offline stownshend

  • byte
  • *
  • Posts: 25
    • View Profile
Behaviour of World.addObject() method
« on: August 18, 2011, 10:21:50 pm »
Hi all,

I've imported a 3DS model created by a friend which is a flat map-like model to be used as the basis for my level.

Once I've created it and I call world.addObject(level1map); what is the default position in world space at which the object is added? The origin?

And how does it place the object? Which vertex does it choose to position at the origin/start point? i.e. does it start from the lowest x, highest y, lowest z co-ordinate or something? Or is there a "centre" property in a 3DS model?

At the moment its centred at 717,-83,95 and I don't know why.

(In writing this I think I might know why this is happening... I'm scaling the model to 1% of its original size which is my problem - if I am going to scale it I probably need to find the "centre" of the model and place it on the origin first if I want it to sit at 0,0,0 in world space).

Any advice / points to information around how to translate and find the centre of an object in worldspace would be much appreciated.

FYI I'm new to 3D modelling in Android, but I have done two basic Open GL projects using GL/GLU/GLUT in the distant past.

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: Behaviour of World.addObject() method
« Reply #1 on: August 18, 2011, 10:24:44 pm »
As long as you haven't any transformations applied, world space is object space, i.e. what's at the origin of your model will be at the origin of the world.

Offline stownshend

  • byte
  • *
  • Posts: 25
    • View Profile
Re: Behaviour of World.addObject() method
« Reply #2 on: August 20, 2011, 01:34:43 am »
Thanks for your answer. The issue was that my modeller wasn't choosing an origin for the models, so they were being place far away in the world space from where I expected them to be.