|
18th May 2005, 11:18 AM | #1 |
Administrator
Professional user
Join Date: Jun 2003
Posts: 4,565
|
You can use something like this:
Code:
Prototype void person_turn_left(Person *person, float angle) //angle in degrees { float m[16], m2[16]; matrix4_set_rotation(-angle, 0, 1, 0, m); matrix4_multiply(m2, person->matrix, m); matrix4_copy(person->matrix, m2); person_set_direction_from_matrix(person); } Prototype void person_set_direction_from_matrix(Person *person) { person->direction.x= person->matrix[2]; person->direction.y= person->matrix[6]; person->direction.z= person->matrix[10]; } gluLookat is used to setup the 'camera' viewpoint in OpenGL, You pass it a location and a direction (which can be location + direction) and OpenGL does all the stuff to set the viewing matrix. Andy |
|
|