Main Menu
Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - tbj

#1
Support / Re: Losing transforms on MergeObjects(...)
December 07, 2011, 01:54:57 PM
Thanks Egon - that worked a treat.  :)

Love the engine by the way - so easy to use! Especially for someone like me who doesn't like maths and has been struggling with pure OpenGL for quite a while...
#2
Support / Losing transforms on MergeObjects(...)
December 06, 2011, 11:06:15 PM
Hi all,

Newbie here - sorry if this has been asked before.

I've got a class called SceneManager. This contains an ArrayList called sceneObjects which is a list of primitives (in this case, boxes) to be drawn in the scene.

Code:

Object3D scene = new Object3D(0);

for (SceneManager.SceneObject s: sceneManager.sceneObjects)
{
System.out.println("Adding object at x:" + s.x + " y: " + s.y + " z: " + s.z);
Object3D newObject = Primitives.getBox(13.0f, 1.0f);

newObject.translate(new SimpleVector(s.x, s.y, s.z));
scene = Object3D.mergeObjects(scene, newObject);

}

world.addObject(scene);


I'm trying to get all my objects merged into one so I can generate an Octree from it.

However... after merging newObject into scene, in the code above, the object seems to lose its transforms, and all my boxes end up in the same place.

If, on the other hand, I add each newObject to the World, the transforms work as expected.

Now...

- Is this what is meant to happen?
- If so, what should I do instead?

Am I right in trying to merge all my objects into one before I generate the Octree?

Should I be doing something with addChild instead?

I have read the Javadocs but I'm not too clear on this. Perhaps someone could help a newbie in distress.

Cheers :)