Laser beam instead of crosshair

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.
XFactor
Posts: 39
Joined: Fri Jun 03, 2005 5:30 am

Laser beam instead of crosshair

Post by XFactor »

How would you make a laser beam that extends out from the camera.


Thank you very very much.
Last edited by XFactor on Sat Jun 04, 2005 8:30 pm, edited 1 time in total.
IRRLICHT ROCKS!!!!
Midnight
Posts: 1772
Joined: Fri Jul 02, 2004 2:37 pm
Location: Wonderland

Post by Midnight »

one way would be to make a beam model or billboard and attach it to the camera.

personally I would try to use 3d line... I'm not sure if that would work.
XFactor
Posts: 39
Joined: Fri Jun 03, 2005 5:30 am

Post by XFactor »

1) Which one looks nicer?
2) If the the 3d line looks nicer, then could you please post some code?
3) If a model looks nicer, where would you suggest me looking for one, I cant model?

Thanks a lot. :D
Last edited by XFactor on Sat Jun 04, 2005 8:31 pm, edited 1 time in total.
IRRLICHT ROCKS!!!!
discreet
Posts: 17
Joined: Sat Jun 04, 2005 5:51 am

Post by discreet »

I would use the 3d line, and attatch a billboard to the end where it hits on the world... That was a demo for that except no 3d line was drawn, I beleive you could make it work...

something like this
put it inside the loop

Code: Select all

SMaterial mtl;
mtl.AmbientColor = mtl.DiffuseColor = 
mtl.EmissiveColor = video::SColor(50,0,0,255);
driver->setMaterial(mtl);
//You will need to position it at the camera, and figure out a way
//To make it stay drawn
driver->draw3DLine(vector3df(0,255,0),cam->getTarget(),mtl.AmbientColor);
bitplane
Admin
Posts: 3204
Joined: Mon Mar 28, 2005 3:45 am
Location: England
Contact:

Post by bitplane »

perhaps one of these is what you need-
http://irrlicht.sourceforge.net/phpBB2/ ... php?t=6058
XFactor
Posts: 39
Joined: Fri Jun 03, 2005 5:30 am

Post by XFactor »

@discreet

I tried what you said and my game crashes. :o


Any other ideas?

@ bitplane
Thats not what I am looking for. :)
Thanks for the replies.
IRRLICHT ROCKS!!!!
Midnight
Posts: 1772
Joined: Fri Jul 02, 2004 2:37 pm
Location: Wonderland

Post by Midnight »

doesn't work
XFactor
Posts: 39
Joined: Fri Jun 03, 2005 5:30 am

Post by XFactor »

@ Midnight
Was that a question or a comment?
IRRLICHT ROCKS!!!!
Midnight
Posts: 1772
Joined: Fri Jul 02, 2004 2:37 pm
Location: Wonderland

Post by Midnight »

do you see a question mark in my statement?

of course not if you did that would make it a question not a statement that is the difference between a comment and a question.

not to mention context and I think it was pretty clear the context in which I wrote my comment.


I was pertaining to the above code that attempting to use the ambient lighting will not color a 3dline I have attempted this myself with no luck and have come to the conclusion that this is impossable without using a billboard, model, or other custom means.

If someone can prove me wrong please do.
XFactor
Posts: 39
Joined: Fri Jun 03, 2005 5:30 am

Post by XFactor »

Sorry, Sorry Midnight. I thought that you might of forgot the '?'. You thought you meant that, "OMG, it didnt work, it should have." Once again sorry.
IRRLICHT ROCKS!!!!
Midnight
Posts: 1772
Joined: Fri Jul 02, 2004 2:37 pm
Location: Wonderland

Post by Midnight »

werd 8)
Electron
Posts: 874
Joined: Sun Mar 14, 2004 12:05 am
Location: Massachusetts USA

Post by Electron »

you need the axial billboard scene node someone made a while ago
You do a lot of programming? Really? I try to get some in, but the debugging keeps me pretty busy.

Crucible of Stars
Rush
Posts: 14
Joined: Wed Nov 24, 2004 11:00 am
Location: Hell

Post by Rush »

Code: Select all

SMaterial mtl;
mtl.Lighting = false;
driver->setMaterial(mtl);
//You will need to position it at the camera, and figure out a way
//To make it stay drawn
driver->draw3DLine(vector3df(0,255,0),cam->getTarget(),video::SColor(100,255,0,0));
Should work with correct color this way.
Midnight
Posts: 1772
Joined: Fri Jul 02, 2004 2:37 pm
Location: Wonderland

Post by Midnight »

It works...


Laser.rar
Midnight
Posts: 1772
Joined: Fri Jul 02, 2004 2:37 pm
Location: Wonderland

Post by Midnight »

didn't anybody take a look at my demo??
Post Reply