• ### Announcements

#### Archived

This topic is now archived and is closed to further replies.

# building & rotating a 2d quad (directX)

## Recommended Posts

leedude    122
im trying to build a quad based on my players position, heading and left facing vectors, and the size of the player. this is my code currently, and it draws the quad based on its size and position:
        point[0].position.x = vPosition.x + size;
point[0].position.y = vPosition.y + size;
point[0].position.z = 0;
point[0].rhw = 1;
point[0].tu = 0.0f; point[0].tv = 0.0f;

point[1].position.x = vPosition.x - size;
point[1].position.y = vPosition.y + size;
point[1].position.z = 0;
point[1].rhw = 1;
point[1].tu = 1.0f; point[0].tv = 0.0f;

point[2].position.x = vPosition.x + size;
point[2].position.y = vPosition.y - size;
point[2].position.z = 0;
point[2].rhw = 1;
point[2].tu = 0.0f; point[2].tv = 1.0f;

point[3].position.x = vPosition.x - size;
point[3].position.y = vPosition.y - size;
point[3].position.z = 0;
point[3].rhw = 1;
point[3].tu = 1.0f; point[3].tv = 1.0f;

i try and pen and paper out how i am going to do these things and when it comes to rotating the players heading im confused about how i build my quad based on the new heading and position. main thing thats confusing me is that i have a 2d map for the player to walk around, with the top left corner being (0,0), and when i think i need a negative axis also to move my player around, or do i? its late and i mite not be thinking straight. could anyone help me on maybe how they would go about building this players quad depending on its heading and position please...i dont need to know how to rotate the heading or anything, i thinkk i have that down....just building a quad from it. any help is appreciated...cheers "take that space coyote!"

##### Share on other sites
Oluseyi    2103
Your vertices should be specified in clockwise or counter-clockwise order. Yours goes from lower-right to lower-left to upper-right to upper-left.