Center of the world

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
kallaspriit
Posts: 27
Joined: Thu Sep 15, 2005 3:22 pm

Center of the world

Post by kallaspriit »

Hi everybody!

What does the engine take as 0,0,0 (total center) point of the world when there are several scene nodes? I'm implementing a debug display and when there is only one node involved, it acts as expected but when I add new ones, it takes one of the visible scene nodes as center point.. hard to explain but here's a picture:

Image

The blue, red, green lines are drawn through 0, 0, 0 then there are the AABB boxes of objects and red collision debug data (the balls). I want the orign of the ground to be the center of the world..

Hope someone understood my problem and has any ideas :P
JP
Posts: 4526
Joined: Tue Sep 13, 2005 2:56 pm
Location: UK
Contact:

Post by JP »

The centre of the world wont change.. If you want the centre to be the centre of the ground then just arrange the centre of the ground to coincide with 0,0,0

But that's probably not very helpful to you as you say it's ok with just one node and then changes when more are added...
Image Image Image
Guest

Post by Guest »

Ja, ich weiß exactly vhat you mean, cause i alvays drop to ze ground and have to find ze right point by trial and error. But vhat you vhere mentioning should be considered a bug.

Cause vhen ze center even depends on your geometry respectively ze different objects you are loading, I consider it not very clear and deviating from ze ozerwise very very attractive Irrlicht philosophy. In my humble opinion, Niko may want to change zis vhenever he has time and feels like it. Schitteboehn.
kallaspriit
Posts: 27
Joined: Thu Sep 15, 2005 3:22 pm

Post by kallaspriit »

Is there a good trick to avoid it?
kallaspriit
Posts: 27
Joined: Thu Sep 15, 2005 3:22 pm

Post by kallaspriit »

So the problem has gotten real wierd. I have a base class for a shape that is used to derive a sphere and so on. In the declaration of the class, when I set an character array size to 153, there is the moving of the center of the world problem, if I set it to 152, the problem disappears :?

Code: Select all

#ifndef SHAPE_H
#define SHAPE_H

#include "Game.h"

class Shape
{
    public:
        Shape(Game* nGame = 0);
        scene::IAnimatedMesh* mesh;
        scene::ISceneNode* node;
        NewtonBody* body;
        NewtonCollision* collision;
        core::matrix4 matrix;
        float mass;
        float inertiaX;
        float inertiaY;
        float inertiaZ;
        void setMass(float nMass);
        void setLocation(core::vector3df location);
        void setInertia(float iX, float iY, float iZ);
        void setMeshfile(char fileName[100]);
        void setNode(scene::ISceneNode* nNode);
        void setBody(NewtonBody* nBody);
        void setCollision(NewtonCollision* nCollision);
        void setMatrix(core::matrix4 nMatrix);
        void create();
        char meshFile[153]; // setting array size to 152 will eliminate the problem
    protected:
        Game* game;  
};

void shapeTransformEvent(const NewtonBody* body, const float* matrix);

#endif

I'm confused..
kallaspriit
Posts: 27
Joined: Thu Sep 15, 2005 3:22 pm

Post by kallaspriit »

Any ideas anyone? The problem is still there :(
Post Reply