Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

My scenario: RTS combat style, 1 unit fires beam on another unit

My problem is i want to draw a flat texture between 2 Vector3 points. I have looked at various Billboarding styles but that doesn't give me a proper solution.

I looked at this:

is BasicEffect and DrawPrimitives the correct solution just stretch the texture to the distance between point of origin to target? I used the quad class they used but i found this it seemed to inflexible

So my question to you is how would i go about this sort of problem?


share|improve this question

There are some aspects of billboarding you can use, but not all of it. The beam can either be a model or you can set up a series of 4 vertices and update it each frame and use DrawPrimitives if you want.

I've done it by using a model of a Plane (4 vertices) and stretching and orienting(partial billboarding) its matrix to cause the beam to display properly.

Mostly it's about building an orthogonal matrix to transform the beam vertices properly.

Here's a video of the way I did a similar thing for someone who asked a similar question. If you want the source code, email me.

share|improve this answer
Hi, this is exactly what i want. I'm not sure how to email in Exchange but your source code would be extremely useful – Sparky41 Nov 5 '12 at 14:53
I have my email in my user profile, I thought it would show publicly. It is steve (dot) hazen (at) gmail (dot) com – Steve H Nov 6 '12 at 13:25
Cool i've sent you an email – Sparky41 Nov 6 '12 at 15:59

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.