Tag Archives: CSharp

Fast 2D Collision Detection in XNA

As shown in the YouTube video in the post Fast collision detection in XNA, I made a quick way of doing near pixel perfect collision detection in XNA that does not get slowed down by rotating the object. This algorithm first checks the bounds of the object that scales based on the rotation of the […]

func

Determining if two lines intersect

Today we are going to take a look at intersecting lines. There are some information on this scattered around the internet, but a good example is hard to find. The uses for this is mainly in 2D, it can be applied to lighting, physics and all other applications using rays. To solve this, we want […]

Article listing

Just a quick notice: The articles has now been listed for your convenience. The complete list can be found here. On another note, I have been very busy with my master thesis, but I will get to posting the article on line intersection shortly as well as give you the complete source code for a […]

Drawing lines in XNA

As there is no built in way of drawing lines in XNA(which is really weird), I thought that I should share this little snippet. public void drawLine(SpriteBatch spriteBatch, Vector2 p1, Vector2 p2, Texture2D texture) { float length = (float)Math.Sqrt((p2x – p1x) * (p2x – p1x) + (p2y – p1y) * (p2y – p1y)); spriteBatch.Draw(texture, new […]