Archived

This topic is now archived and is closed to further replies.

LASERS!!! - Desperate!!

This topic is 5504 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hey folks, I''m so stumped over this laser problem. I''ve got a laser object: four vertex textured quad that resembles a long skinny bookmark. I need a way to angle this object towards the camera somehow so that it doesn''t look like a flat object. Unforunately, I don''t really know how to explain what exactly would make it do this other than I know that if the two vertices closest to the camera are exactly the same distance from the camera, without actually pointing the laser in a different direction, it will work. I KNOW there is a way to do this because every single game that has lasers or missile trails or tracer bullets or anything similar can do it. Just wondering if there is any D3DXMATRIX math function that will make this happen. Thanks for any help whatsoever, Ryan Buhr Reactor Interactive, LLC.

Share this post


Link to post
Share on other sites
it sounds like you want billboarding, oriented along the shot axis rather than the z axis. Look into billboarding tutorials, and all shall be revealed.


Don''t listen to me. I''ve had too much coffee.

Share this post


Link to post
Share on other sites
tempvector = crossproduct((laserend0 - laserend1), (laserend0 - cameraposition));
normalize(tempvector);
laservert0 = laserend0 + tempvector*constant;
laservert1 = laserend0 - tempvector*constant;
laservert2 = laserend1 + tempvector*constant;
laservert3 = laserend1 - tempvector*constant;

Share this post


Link to post
Share on other sites