Drawing Visible 3d Line from Node

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
mubashar
Posts: 63
Joined: Wed Sep 07, 2011 7:20 pm

Drawing Visible 3d Line from Node

Post 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
When it's all over, it's not who you were. It's whether you made a difference
zerochen
Posts: 273
Joined: Wed Jan 07, 2009 1:17 am
Location: Germany

Re: Drawing Visible 3d Line from Node

Post 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
mubashar
Posts: 63
Joined: Wed Sep 07, 2011 7:20 pm

Re: Drawing Visible 3d Line from Node

Post by mubashar »

@zerochen thanks dude i hope it will give me some startup :)
When it's all over, it's not who you were. It's whether you made a difference
mubashar
Posts: 63
Joined: Wed Sep 07, 2011 7:20 pm

Re: Drawing Visible 3d Line from Node

Post 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));
When it's all over, it's not who you were. It's whether you made a difference
zerochen
Posts: 273
Joined: Wed Jan 07, 2009 1:17 am
Location: Germany

Re: Drawing Visible 3d Line from Node

Post 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();?
smso
Posts: 246
Joined: Fri Jun 04, 2010 3:28 pm
Location: Hong Kong

Re: Drawing Visible 3d Line from Node

Post 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
CuteAlien
Admin
Posts: 9670
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: Drawing Visible 3d Line from Node

Post 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.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
mubashar
Posts: 63
Joined: Wed Sep 07, 2011 7:20 pm

Re: Drawing Visible 3d Line from Node

Post by mubashar »

@smso and @CuteAleien Yes that's the problem Finally can see it :) thanks for help
When it's all over, it's not who you were. It's whether you made a difference
Post Reply