• Create Account

Awesome job so far everyone! Please give us your feedback on how our article efforts are going. We still need more finished articles for our May contest theme: Remake the Classics

### #ActualRedShft

Posted 12 April 2012 - 11:50 PM

I'm having a problem correctly displaying rotation when applying a matrix that transforms from local to world space in two dimensions.I have an actors heading and side vector, which represent local space, it's, vertices in local space and it's position in the world. So far I can successfully transform it's vertices from local space to world space but adding in rotation gives unexpected results with the actor not holding it's shape.

I started by creating an identity matrix, then creating a rotation matrix, multiplying those, then creating a translation matrix, and getting the resulting matrix.

The rotation matrix is where I get confused and where the problem is. The way it's setup now is that the heading is a vector from the actor's position that represents it's x-axis in local space, and the side vector represents it's y-axis in local space. I then took the x and y components of these vectors to create the rotation matrix like this:

```   {  heading.x, heading.y, 0,
side.x,  side.y, 0,
0,      0,     1 }
```

I'm sure this is entirely wrong, and I would appreciate any help anyone could give me to clear this up.

### #1RedShft

Posted 12 April 2012 - 11:49 PM

I'm having a problem correctly displaying rotation when applying a matrix that transforms from local to world space in two dimensions.I have an actors heading and side vector, which represent local space, it's, vertices in local space and it's position in the world. So far I can successfully transform it's vertices from local space to world space but adding in rotation gives unexpected results with the actor not holding it's shape.

I started by creating an identity matrix, then creating a rotation matrix, multiplying those, then creating a translation matrix, and getting the resulting matrix.

The rotation matrix is where I get confused and where the problem is. The way it's setup now is that the heading is a vector from the actor's position that represents it's x-axis in local space, and the side vector represents it's y-axis in local space. I then took the x and y components of these vectors to create the rotation matrix like this:

```   {  heading.x, heading.y, 0,
side.x,	   side.y,	  0,
0,			  0,			  1 }
```

I'm sure this is entirely wrong, and I would appreciate any help anyone could give me to clear this up.

PARTNERS