Path: chuka.playstation.co.uk!chuka.playstation.co.uk!chuka.playstation.co.uk!not-for-mail From: Lewis_Evans@Playstation.sony.com Newsgroups: scee.yaroze.beginners Subject: World---->Local convertion Date: 2 Mar 1998 12:40:20 -0000 Organization: Sony Computer Entertainment Europe - 119.SS5 Lines: 104 Sender: news@chuka.playstation.co.uk Message-ID: <6de9bk$qi01@emeka.playstation.co.uk> Reply-To: Lewis_Evans@Playstation.sony.com NNTP-Posting-Host: emeka.playstation.co.uk by mail2.fw-sj.sony.com (8.8.8/8.8.8) with ESMTP id EAA13354 for ; Mon, 2 Mar 1998 04:44:53 -0800 (PST) From: Lewis_Evans@Playstation.sony.com To: news@playstation.co.uk If you want to express the coordinates of a world point in a local coordinate system, you can just use the technique as the SCEE demos 'flying' and 'dungeon'; those demos involve ships hunting and shooting at each other, to do this they express the target ship's position in their own coord system. This is done by using the fact that a coordinate system's matrix is just a set of 3 vectors specifying the local x,y and z axes. Here's a couple of functions, nearly the same, but the different ways of accessing the matrix elements mean that one does sub->super conversion and the other does super->sub. Lewis // eg know position or vector in world space, // want to find it in object coordinate terms // NOTE: Only takes account of rotation // NOT displacement as well void ExpressSuperPointInSub (VECTOR* superPoint, GsCOORDINATE2* subSystem, VECTOR* subPointOutput) { MATRIX* matrix; matrix = &subSystem->coord; setVECTOR(subPointOutput, ((superPoint>vx * matrix->m[0][0] + superPoint>vy * matrix->m[0][1] + superPoint>vz * matrix->m[0][2]) >> 12), ((superPoint>vx * matrix->m[1][0] + superPoint>vy * matrix->m[1][1] + superPoint>vz * matrix->m[1][2]) >> 12), ((superPoint>vx * matrix->m[2][0] + superPoint>vy * matrix->m[2][1] + superPoint>vz * matrix->m[2][2]) >> 12) ); } // eg know position or vector in object space, // want to find it in world coordinate terms // NOTE: Only takes account of rotation // NOT displacement as well void ExpressSubPointInSuper (VECTOR* subPoint, GsCOORDINATE2* subSystem, VECTOR* superPointOutput) { MATRIX* matrix; matrix = &subSystem->coord; setVECTOR(superPointOutput, ((subPoint>vx * matrix->m[0][0] + subPoint>vy * matrix->m[1][0] + subPoint>vz * matrix->m[2][0]) >> 12), ((subPoint>vx * matrix->m[0][1] + subPoint>vy * matrix->m[1][1] + subPoint>vz * matrix->m[2][1]) >> 12), ((subPoint>vx * matrix->m[0][2] + subPoint>vy * matrix->m[1][2] + subPoint>vz * matrix->m[2][2]) >> 12) ); } To: Lewis Evans cc: From: news @ playstation.co.uk Subject: World---->Local convertion:scee.yaroze.beginners From: "Emanuele Diotallevi" Newsgroups: scee.yaroze.beginners Subject: World---->Local convertion I'm programming collisions with Bounding boxes ,but i must find the local coord. of a point in the world,so lw matrix calculates world coord from local cord ,i thinked that i must calculate the inverse matrix of lw matrix calculating the (in italian we say " Determinante ") : LW^(-1) =((LW^a)^t)/Det.(LW)??? If there's someone that have a function that calculates the A^(-1) matrix please help me!