Page 1 of 1

Draw3dLine draws at wrong place!

Posted: Thu Jun 09, 2005 10:09 am
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

Posted: Fri Jun 10, 2005 3:02 am
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.

Posted: Fri Jun 10, 2005 4:58 am
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.

Posted: Mon Jun 13, 2005 10:46 am
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]

Posted: Mon Jun 13, 2005 11:47 am
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.

Posted: Mon Jun 13, 2005 4:15 pm
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...

Posted: Mon Jun 13, 2005 4:52 pm
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?

Posted: Mon Jun 13, 2005 7:17 pm
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