[Plib-users] Rotation problems
Brought to you by:
sjbaker
|
From: <m6...@ma...> - 2002-02-16 19:02:28
|
Hello,
I am a new to 3D programming. Basically I wanted to use a library to create my
own world. I managed to load a 3ds object file thanx to plib engine. It
was fantastic.
Until I came to the rotation problems which do not make any sense to me.
I need
to say here that I would like to notify, that documentation is not so
good...It
leaves functions to be guessed on how a man can use them. Anyway, with the aid
of the tutorials (which were something more like stand-alone apps :)
rather than
simple tutorials ) came to this conclusion to use:
if ( ( k == 'o' ) || ( k == 'O' ) )
{
//Matrices
static float theta = 0.1f;
sgMat4 rx =
{
{cos( theta ), -sin( theta ), 0.0f, 0.0f},
{sin( theta ), cos( theta ), 0.0f, 0.0f},
{0.0f, 0.0f, 1.0f, 0.0f},
{0.0f, 0.0f, 0.0f, 1.0f}
};
//This do the rotation
sgMat4 finalTRANSFORM;
sgMat4 3DSMat4;
sgMakeCoordMat4( 3DSMat4, 3DSpos.xyz, 3DSpos.hpr );
sgMultMat4( finalTRANSFORM, rx, 3DSMat4 );
sgSetCoord( &3DSpos, finalTRANSFORM );
3DS_object->setTransform( &3DSpos );
}
Please, if you have the time, tell me what I do wrong here...
What I WANT to do and not what OpenGL wants ;) is to rotate the object around
its own axis, and not around the X,Y,Z axis of the "3D - world". After days of
examination this was the closest solution I could find.
I would appreciate very much any help I could take. As the reason which I
use the
plib is the fact that I want to learn and create rather than utilizing a
library that
would do anything on it's own. One...more: When I change hpr of the
object I do
not take anything as responce.On the other hand teasing the xyz just moves the
object. Is that also -at least- correct way to move the object?
Thanx in advance...
-------------------------------------------------------------
http://www.mail.gr/ - Get Your Private Free Email Address!
http://www.ringtone.gr/ - Ringtones & Logos for your mobile!
|