Path: chuka.playstation.co.uk!news1.scei.co.jp!scea!greg_labrec@interactive.sony.com From: Joshua Meeds Newsgroups: scea.yaroze.programming.2d_graphics Subject: Re: Rotating 2-d images around the X and Y axis Date: Wed, 04 Mar 1998 20:53:52 -0800 Organization: SCEA News Server Lines: 59 Message-ID: <34FE2FE0.9D752DAE@sinclair.net> References: <34D6AEC6.6A77@mail.tdsnet.com> <34d7359c.686229@205.149.189.29> NNTP-Posting-Host: dreamer.sincom.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Mailer: Mozilla 4.04 [en] (Win95; I) It sounds like he is talking about 2d rotations, not 3d ones. 2d ones are easy, and built into the Sprite structures quite nicely. Here's an example from my game, Faces of Evil (which is on my website with code): To set up the standard Sprite structure for rotation, here is what is needed. Ship.attribute = 0x03000000; //(I forget all of the details, but you have to setup the attribute to allow // rotation.) Ship.mx = 21; // mx,my=center of rotation (or scaling). 21,33 is the center of my ship. Ship.my = 33; Ship.scalex = ONE; // Defined as 4096 (scaling is very similar to rotation) Ship.scaley = ONE; // Defined as 4096 Ship.rotate = 0; // Rotation set to 0 to start To rotate the sprite, before it is drawn you then just change Sprite.rotate, as shown from my game: if((padval[3])&&(Time2==0)) { Ship.rotate+=ONE*22.5; j++; if(j>15) j=0; if(Ship.rotate>1470464) Ship.rotate=0; Time2++; } ONE is set by default to equal 4096, which in sprite rotation is 1 degree. Thus, this little section rotated the ship clockwise by 22.5 degrees (ONE * 22.5). Ignore j, it was there for my game (I had a table setup for how to move the ship based on its rotation). Also, Time2 was just to keep it from rotating too quickly. Finally, when drawing the sprite to the screen, you can't use GsSortFastSprite, you have to use normal GsSortSprite, as shown: GsSortSprite(&Ship,&WorldOT[activeBuff],0); Hope that helps someone! -- - Dreamwriter Dragon dreamer@sinclair.net -==UDIC==- Mario Perdue wrote: > If you really want to rotate it, you can't. You could simulate a > rotation by changing the axis scale, but this doesn't change the > perspective of the image so it's kind of cheesy. > > If you want to flip it, just give the axis a negative value. > > Mario