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: http://msdn.microsoft.com/en-us/library/bb464051.aspx

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?



1 Answer 1


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. http://www.screencast.com/t/LDzD2NXOZ

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .