#### Archived

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

# LASERS!!! - Desperate!!

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

## 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 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 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 on other sites
Reverse the view matrix then translate.

.lick

1. 1
Rutin
31
2. 2
3. 3
4. 4
5. 5

• 13
• 48
• 11
• 10
• 14
• ### Forum Statistics

• Total Topics
632965
• Total Posts
3009545
• ### Who's Online (See full list)

There are no registered users currently online

×