Go Back   AC3D Forums > Technical > AC3D Developers
Register FAQ Members List Calendar Today's Posts

Reply
 
Thread Tools Display Modes
Old 18th May 2005, 11:18 AM   #1
Andy
Administrator
Professional user
 
Andy's Avatar
 
Join Date: Jun 2003
Posts: 4,565
Default

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
Andy is offline   Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



All times are GMT -4. The time now is 04:01 AM.


AC3D Forum
(C) Inivis Limited 2020