Page 1 of 1

Center of the world

Posted: Thu Sep 15, 2005 3:33 pm
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

Posted: Thu Sep 15, 2005 4:38 pm
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...

Posted: Thu Sep 15, 2005 5:52 pm
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.

Posted: Fri Sep 16, 2005 12:11 pm
by kallaspriit
Is there a good trick to avoid it?

Posted: Fri Sep 16, 2005 12:42 pm
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..

Posted: Sun Sep 18, 2005 11:31 am
by kallaspriit
Any ideas anyone? The problem is still there :(