Draw3dLine draws at wrong place!

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
Beam

Draw3dLine draws at wrong place!

Post by Beam »

Hi

My terrainnode has a corner in (0,0,0), if I place a node at (0,0,0) it sits at that point, BUT:

When i use draw3dLine:
driver->draw3DLine(vect3d(0,0,0),vect3d(0,400,0),black);

this vertical line is not at the same place! Its a bit off, neighter x nor z seems to be correct. What might be the problem?

Thx
Beam
Midnight
Posts: 1772
Joined: Fri Jul 02, 2004 2:37 pm
Location: Wonderland

Post by Midnight »

not really sure...interesting question for a man by the name of beam..

I made a laser sights demo and it seems a bit odd itself.
Rabid Mantis
Posts: 61
Joined: Sun May 08, 2005 11:30 am

Post by Rabid Mantis »

Sounds like you just need to set the transformation for the driver.
try putting this just before the driver->draw3DLine line:

driver->setTransform(video::ETS_WORLD, core::matrix4());


Depending on what you've done with your program, you may need to fix some of your other graphics code to work with the fixed transformation. Also, you don't need to put this every time you draw a line. Test it to see if it works, and if it does, you can cut/paste it up to just before your main program loop. Of course it all depends on what you do with your code, but you'll probably only need this one line. If you end up setting any more transformations you may need to add this other places as well.
Beam

Post by Beam »

I put it before my main-loop (doesnt work) then I put it inside my main-loop (doesnt work)
I found one transform in my code and that's this one below. Can it matter?

Code: Select all

void rotateNodeRel(irr::scene::ISceneNode * node, irr::core::vector3df difference){

    irr::core::matrix4 m = node->getRelativeTransformation(); 
    irr::core::matrix4 n; 
    n.setRotationDegrees(difference); 
    m *= n; 
    node->setRotation( m.getRotationDegrees() ); 


}

How can only the position of draw3dline screw up and nodes and the rest work fine? Don't they use the same 3D-coordinates?

Thanks for sorting this out.
Beam[/code]
Thulsa Doom
Posts: 63
Joined: Thu Aug 05, 2004 9:40 am
Location: Germany

Post by Thulsa Doom »

Beam,
do you still work in orthographic projection while using 3D Lines?
there's an old thread, where I have discussed similar problems.
http://irrlicht.sourceforge.net/phpBB2/ ... =joy#20692
does this fit here?
If not, nevermind.
Beam

Post by Beam »

Sorry Thulsa (great movie by the way...) im not using ortho with this one, just normal camera, but the lines are cracked up anyway...
don_Pedro
Posts: 84
Joined: Fri Jun 10, 2005 1:34 pm
Location: Poland
Contact:

Post by don_Pedro »

Are you sure it's not a problem with terrain node and exactly with line? It seems everything's ok with it, maybe you're not searching bug where it actually lurks?
Beam

Post by Beam »

Ok, now its fine.

If i put the line
driver->setTransform(video::ETS_WORLD, core::matrix4());

every tick just before drawing those lines to the screen it draws it were I tell it to draw. Dont get really what this is all about but now it works... Strange i didnt try that before, but that's maybe becouse i dont understand what they do :>

Well thanks for your patiance!
Beam
Post Reply