Path: chuka.playstation.co.uk!news From: "Rikki Prince" Newsgroups: scee.yaroze.programming.3d_graphics Subject: Re: more 3d problems.. Date: Mon, 26 Apr 1999 17:24:27 +0100 Organization: PlayStation Net Yaroze (SCEE) Lines: 53 Message-ID: <7g243s$7352@chuka.playstation.co.uk> References: <3721F00A.D31147E8@bournemouth.ac.uk> NNTP-Posting-Host: th-gt141-091.pool.dircon.co.uk X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.00.2014.211 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2014.211 > > PS and in related news.. anyone know how to put a 2d background in a 3D > world? > I dunno if this will help, but taken from the Yaroze FAQ: How do I place a 2D sprite in a 3D world? In a 3D game, sometime you want to insert sprites into the world as if they were true 3D objects. For instance, in a racing game, you might want to make all the trees at the side of the road sprites instead of true 3D objects. If you choose this method, you must first have calculated the X/Y/Z position of your sprite in the 3D world. The following code fragment will calculate the required screen coordinates and scale, and insert it into the Ordering Table for you. This code fragment requires 2 constants - the Projection Distance (the value that you use as the parameter to GsSetProjection()) and the Ordering Table length (from 1 to 14). (This code sample by Harvey C and James Russell) void draw_3dsprite (GsSPRITE *sprite,VECTOR spritePosition) { // The spritePosition is the point in 3D space (world coords) that your sprite lies at. VECTOR transformedPosition; extern MATRIX GsWSMATRIX; ApplyMatrixLV(&GsWSMATRIX,&spritePosition,&transformedPosition); transformedPosition.vx += GsWSMATRIX.t[0]; transformedPosition.vy += GsWSMATRIX.t[1]; transformedPosition.vz += GsWSMATRIX.t[2]; if (transformedPosition.vz>0) { // Only draw sprite if it's in front of the camera. // Scales the sprite according to the distance. sprite->scalex = sprite->scaley = (ONE << 12) / transformedPosition.vz; sprite->x = transformedPosition.vx * PROJECTION_DISTANCE / transformedPosition.vz; sprite->y = transformedPosition.vy * PROJECTION_DISTANCE / transformedPosition.vz; GsSortSprite(&sprite,&OTable_Header[GsGetActiveBuffer()],transformedPosition .vz >> (14 - ORDERING_TABLE_LENGTH)); } } I don't know enough about 3d to tell you anything else, sorry. Rikki