becoolnike
asked on
How do i rotate a quad by its origen/pivot point? direct3d
How do i rotate a quad by its origen/pivot point? direct3d
i use the following: for define my quad i know how to rotate it by it rotates by the top-left point and not by his origen point? any help?
i really need this.
vertexarray[0].x := 0;
vertexarray[0].y := 0;
vertexarray[0].z := 0.0;
vertexarray[1].x := 0;
vertexarray[1].y := 64;
vertexarray[1].z := 0.0;
vertexarray[2].x := 0;
vertexarray[2].y := 0;
vertexarray[2].z := 0.0;
vertexarray[2].rhw := 1.0;
vertexarray[3].x := 64;
vertexarray[3].y := 0;
vertexarray[3].z := 0.0;
vertexarray[4].x := 64;
vertexarray[4].y := 0;
vertexarray[4].z := 0.0;
vertexarray[5].x := 64;
vertexarray[5].y := 64;
vertexarray[5].z := 0.0;
vertexarray[6].x := 0;
vertexarray[6].y := 64;
vertexarray[6].z := 0.0;
i use the following: for define my quad i know how to rotate it by it rotates by the top-left point and not by his origen point? any help?
i really need this.
vertexarray[0].x := 0;
vertexarray[0].y := 0;
vertexarray[0].z := 0.0;
vertexarray[1].x := 0;
vertexarray[1].y := 64;
vertexarray[1].z := 0.0;
vertexarray[2].x := 0;
vertexarray[2].y := 0;
vertexarray[2].z := 0.0;
vertexarray[2].rhw := 1.0;
vertexarray[3].x := 64;
vertexarray[3].y := 0;
vertexarray[3].z := 0.0;
vertexarray[4].x := 64;
vertexarray[4].y := 0;
vertexarray[4].z := 0.0;
vertexarray[5].x := 64;
vertexarray[5].y := 64;
vertexarray[5].z := 0.0;
vertexarray[6].x := 0;
vertexarray[6].y := 64;
vertexarray[6].z := 0.0;
shift the to left point to the origin, rotate around the origin, translate back
ASKER
i want to shift the to left point to the origin but i dont know how lol.
subtract the coordinates of the top left point from all the points
if your *origin is the center, then substract every x- and y-component of each vertex with 32 and rotate it then:
vertexarray[0].x := 0-32;
vertexarray[0].y := 0-32;
vertexarray[0].z := 0.0;
vertexarray[1].x := 0-32;
vertexarray[1].y := 64-32;
vertexarray[1].z := 0.0;
vertexarray[2].x := 0-32;
vertexarray[2].y := 0-32;
vertexarray[2].z := 0.0;
vertexarray[2].rhw := 1.0;
vertexarray[3].x := 64-32;
vertexarray[3].y := 0-32;
vertexarray[3].z := 0.0;
vertexarray[4].x := 64-32;
vertexarray[4].y := 0-32;
vertexarray[4].z := 0.0;
vertexarray[5].x := 64-32;
vertexarray[5].y := 64-32;
vertexarray[5].z := 0.0;
vertexarray[6].x := 0-32;
vertexarray[6].y := 64-32;
vertexarray[6].z := 0.0;
good luck :)
ike
vertexarray[0].x := 0-32;
vertexarray[0].y := 0-32;
vertexarray[0].z := 0.0;
vertexarray[1].x := 0-32;
vertexarray[1].y := 64-32;
vertexarray[1].z := 0.0;
vertexarray[2].x := 0-32;
vertexarray[2].y := 0-32;
vertexarray[2].z := 0.0;
vertexarray[2].rhw := 1.0;
vertexarray[3].x := 64-32;
vertexarray[3].y := 0-32;
vertexarray[3].z := 0.0;
vertexarray[4].x := 64-32;
vertexarray[4].y := 0-32;
vertexarray[4].z := 0.0;
vertexarray[5].x := 64-32;
vertexarray[5].y := 64-32;
vertexarray[5].z := 0.0;
vertexarray[6].x := 0-32;
vertexarray[6].y := 64-32;
vertexarray[6].z := 0.0;
good luck :)
ike
I thought you said you wanted to rotate around the top-left point rather than around (0,0,0)
Do you want to rotate around its midpoint?
Do you want to rotate around its midpoint?
ASKER
yeah by his midpoint called povot. anyway without locking vertex/
there must be a fucntion using direct3d utils.
there must be a fucntion using direct3d utils.
ASKER
vertex locking takes takes off mush speed of a game.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Forced accept.
Computer101
EE Admin
Computer101
EE Admin