Irrlicht 1.8 light and terrain scene node bugs

You discovered a bug in the engine, and you are sure that it is not a problem of your code? Just post it in here. Please read the bug posting guidelines first.
Post Reply
Nyx Erebos
Posts: 33
Joined: Fri Mar 01, 2013 1:26 am

Irrlicht 1.8 light and terrain scene node bugs

Post by Nyx Erebos »

I already made a topic here http://irrlicht.sourceforge.net/forum/v ... =1&t=49252 about my problem with spotlights.

I came across a bug with the ITerrainSceneNode's position/rotation. Basically it doesn't work the same way as the other nodes. For the position I guess it's normal because there's a getTerrainCenter method but it still is weird imo. The position data are sent by bullet so I had to write something that deal with it :

Code: Select all

core::vector3df newPosition; 
ITerrainSceneNode* terrain = sceneManager->addTerrainSceneNode(/*with all the parameters you want*/);
//let's say you do something here that fills newPosition
terrain->setPosition(core::vector3df(
    newPosition.X - (terrain->getBoundingBox().MaxEdge.X - terrain->getBoundingBox().MinEdge.X)/2,
    newPosition.Y - (terrain->getBoundingBox().MaxEdge.Y - terrain->getBoundingBox().MinEdge.Y)/2,
    newPosition.Z - (terrain->getBoundingBox().MaxEdge.Z - terrain->getBoundingBox().MinEdge.Z)/2)
);


About the rotations I think they're inverted so I wrote a (very ugly, non optimized, probably dumb, etc... :roll: ) bit of code that seems to make things work :

Code: Select all

core::vector3df newRotation;
//fill newRotation
terrain->setRotation(core::vector3df(0,0,0));
core::matrix4 transfo = terrain->getAbsoluteTransformation();
terrain->setRotation(
    (
        core::quaternion(core::vector3df(-newRotation.X,0,0)*core::DEGTORAD).getMatrix()
        *core::quaternion(core::vector3df(0,-newRotation.Y,0)*core::DEGTORAD).getMatrix()
        *core::quaternion(core::vector3df(0,0,-newRotation.Z)*core::DEGTORAD).getMatrix()
        *transfo
    ).getRotationDegrees()
);
Unfortunately I must be doing something wrong because when the terrain node rotates I still can see a small offset but for now it doesn't bother me much.

About the spotlight bug if it's not a bug feel free to fill me in, I'm still searching for the solution.
Post Reply