Rotation of View Matrix for SceGumLookAt ... PLEASE HELP!

Discuss the development of new homebrew software, tools and libraries.

Moderators: cheriff, TyRaNiD

Post Reply
roland
Posts: 13
Joined: Sat Feb 11, 2006 9:11 pm

Rotation of View Matrix for SceGumLookAt ... PLEASE HELP!

Post by roland »

I am slowly loosing my head on this problem..

I am trying to navigate through a small little world of 3d objects and would like to implement a FPS Like camera using SceGumLookAt.

I read tons of Tutorials and the best I came up with now is an orbiting Camera.. I am a real n00b in regards of Vector Math etc. so I am really hoping that this time, somebody out there can help me..

This is the code I use:

Code: Select all

static void mult_matvec(const ScePspFMatrix4 *m,
						const ScePspFVector4 *vi, ScePspFVector3 *vo)
{
	vo->x = m->x.x*vi->x+m->y.x*vi->y+m->z.x*vi->z+m->w.x*vi->w;
	vo->y = m->x.y*vi->x+m->y.y*vi->y+m->z.y*vi->z+m->w.y*vi->w;
	vo->z = m->x.z*vi->x+m->y.z*vi->y+m->z.z*vi->z+m->w.z*vi->w;
}

// Camera
	sceGumMatrixMode(GU_VIEW);
	sceGumLoadIdentity();

	sceGumPushMatrix();
	sceGumRotateX(SCEGU_RAD(CurrentRotationX));
	sceGumRotateZ(SCEGU_RAD(CurrentRotationZ));

	sceGumStoreMatrix(&m);


	vec2.x = center.x;
	vec2.y = center.y;
	vec2.z = center.z;
	vec2.w = 1.0f;
	mult_matvec(&m, &vec2, &center);


	vec2.x = eye.x;
	vec2.y = eye.y;
	vec2.z = eye.z;
	vec2.w = 0.0f;
	mult_matvec(&m, &vec2, &eye);

	sceGumPopMatrix();

	sceGumLookAt( &eye, &center, &up ); // Set viewpoint matrix	
Thank you in advance for your help!!

roland
Post Reply