Page 1 of 2

Laser beam instead of crosshair

Posted: Sat Jun 04, 2005 1:04 am
by XFactor
How would you make a laser beam that extends out from the camera.


Thank you very very much.

Posted: Sat Jun 04, 2005 4:11 am
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.

Posted: Sat Jun 04, 2005 4:26 am
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

Posted: Sat Jun 04, 2005 5:54 am
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);

Posted: Sat Jun 04, 2005 2:10 pm
by bitplane
perhaps one of these is what you need-
http://irrlicht.sourceforge.net/phpBB2/ ... php?t=6058

Posted: Sat Jun 04, 2005 4:57 pm
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.

Posted: Mon Jun 06, 2005 7:03 am
by Midnight
doesn't work

Posted: Tue Jun 07, 2005 4:05 am
by XFactor
@ Midnight
Was that a question or a comment?

Posted: Wed Jun 08, 2005 12:58 am
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.

Posted: Wed Jun 08, 2005 2:29 am
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.

Posted: Wed Jun 08, 2005 5:50 pm
by Midnight
werd 8)

Posted: Wed Jun 08, 2005 7:49 pm
by Electron
you need the axial billboard scene node someone made a while ago

Posted: Wed Jun 08, 2005 8:00 pm
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.

Posted: Thu Jun 09, 2005 9:07 pm
by Midnight
It works...


Laser.rar

Posted: Fri Jun 10, 2005 5:01 pm
by Midnight
didn't anybody take a look at my demo??