Archive for September, 2011

September 11, 2011 0

Video of 2.5D Javascript/WebGL PortalGun

By in chuclone, gamedev, preview

I’m in the middle of adding a Portal gun to¬†chuclone¬†- There are still a few kinks in it, namely related to determining the side of the object the Portal gun hits, and converting the 3D position of your shot into 2D cordinates so that it shoots exactly where you aimed. However I have it far […]

September 10, 2011 0

Getting the angle between two 3D vectors

By in math, snippet

Another short post related to a question I was asked, that I figure might be helpful to others. Getting the angle between two vectors in 2D is as simple as: var angle = Math.atan2(vectorA.y – vectorB.y, vectorA.x – vectorB.x) However that does not work in 3D space, however the angle between any two vectors (2D […]

September 10, 2011 1

Rotate vector / line-segment / polygon around arbitrary point

By in math, snippet

Someone asked me this earlier today, and i made this code snippet and I figured i might as well share it and save it for myself. To rotate a vector, or for that matter a linesegment (which is just two vectors), and again a polygon (which is just n linesegments). All you have to do […]