draw3DLine() is always relative to one of my scene nodes?

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
Josh1billion
Posts: 125
Joined: Thu Dec 11, 2008 9:50 pm
Location: Wisconsin
Contact:

draw3DLine() is always relative to one of my scene nodes?

Post by Josh1billion »

I'm using this line of code:

Code: Select all

driver->draw3DLine(vector3df(0,10,0), vector3df(100, 10, 0));
to draw a 3D line for testing purposes. As you can see, the line is supposed to be drawn from one absolute position (0,10,0) to another (100,10,0), so it should always show up as just one simple line traveling along the X axis.

However, as you can see in this video http://www.youtube.com/watch?v=zbI_Ez7VWk0 , the line is instead being drawn relative to one of my IAnimatedMeshSceneNodes. It even goes so far as to follow the node around once the node starts moving toward the end of the video...

Is this a bug, or have I modified the settings of my video device in some bizarre way?

I'm using Irrlicht 1.7.2

P.S. I think this potential bug is also influencing getSceneNodeFromRayBB(), which is what has noticeable effects on gameplay.. this draw3DLine() test was done only so that I could try and debug the results of my code involving getSceneNodeFromRayBB().
www.JoshForde.com

Latest release: Super Orbulite World.
In development: Season of Dreams and others
Luben
Posts: 568
Joined: Sun Oct 09, 2005 10:12 am
Location: #irrlicht @freenode

Post by Luben »

http://irrlicht.sourceforge.net/docu/cl ... 3a4eebb5e6
For some implementations, this method simply calls drawVertexPrimitiveList for some triangles. Note that the line is drawn using the current transformation matrix and material. So if you need to draw the 3D line independently of the current transformation, use

Code: Select all

                driver->setMaterial(someMaterial);
                driver->setTransform(video::ETS_WORLD, core::IdentityMatrix);
for some properly set up material before drawing the line. Some drivers support line thickness set in the material.
Josh1billion
Posts: 125
Joined: Thu Dec 11, 2008 9:50 pm
Location: Wisconsin
Contact:

Post by Josh1billion »

Thanks for the info. I've called the setTransform() function as you suggested, and now the line is drawn properly.

However, I'm still getting very peculiar behavior with getSceneNodeFromRayBB(). I'm not sure if that's related or not. I'll try and look into it some more.
www.JoshForde.com

Latest release: Super Orbulite World.
In development: Season of Dreams and others
Post Reply