Page 1 of 1

Drawing Visible 3d Line from Node

Posted: Thu Jan 26, 2012 6:35 pm
by mubashar
Hello i want to originate Visible 3d line from my node and want to calculate collisions on basis of distance from node to node using line .... is it possible i want to do something like this ..

please check out

http://www.youtube.com/watch?v=FKAULFV8tXw

Re: Drawing Visible 3d Line from Node

Posted: Thu Jan 26, 2012 6:45 pm
by zerochen
you don't really ask if it is possible to draw simple lines or?

anyway maybe you have a look at this snippet
http://irrlicht.sourceforge.net/forum/v ... eld+effect

Re: Drawing Visible 3d Line from Node

Posted: Thu Jan 26, 2012 7:09 pm
by mubashar
@zerochen thanks dude i hope it will give me some startup :)

Re: Drawing Visible 3d Line from Node

Posted: Fri Jan 27, 2012 7:07 am
by mubashar
Tried This But Failed To Draw Line Whats Problem With This Code ?

Code: Select all

        core::line3d<f32> ray;
                core::line3d<f32> ray1;
                ray.start = camera->getPosition();
                ray.end = ray.start + (camera->getTarget() - ray.start).normalize() * 1000.0f;
                        video::SMaterial m; 
   m.Lighting=false;
   m.Thickness = 1.0f;
   driver->setMaterial(m);
   driver->setTransform(video::ETS_WORLD, core::matrix4());             
                        driver->draw3DLine(ray.end,ray.start,video::SColor(0,255,255,255));

Re: Drawing Visible 3d Line from Node

Posted: Fri Jan 27, 2012 8:11 am
by zerochen
1. the lines are full transparent
2. maybe the draw call is not between driver->beginScene(true, true, video::SColor(50,50,50,50)); & driver->endScene();?

Re: Drawing Visible 3d Line from Node

Posted: Fri Jan 27, 2012 9:08 am
by smso
Maybe the line of sight of the camera coincides with the "3d Line". Try offseting ray.end to see whether the line is visible.

Regards
smso

Re: Drawing Visible 3d Line from Node

Posted: Fri Jan 27, 2012 9:26 am
by CuteAlien
A point from camera-start to target is likely only visible as a single pixel in the center. Try moving it up/down/left/right a little and you should probably see a line.

Re: Drawing Visible 3d Line from Node

Posted: Fri Jan 27, 2012 9:36 am
by mubashar
@smso and @CuteAleien Yes that's the problem Finally can see it :) thanks for help