Path: chuka.playstation.co.uk!scea!greg_labrec@interactive.sony.com From: Manny Najera Newsgroups: scea.yaroze.programming.2d_graphics Subject: Re: Algorithm to orbit? Date: Sun, 03 Aug 1997 14:54:22 -0500 Organization: SCEA Net Yaroze News Lines: 33 Message-ID: <33E4E1EE.7CE0791A@ix.netcom.com> References: <01bca03a$5c9d6ee0$8bf135ce@jjustice.iquest.net> NNTP-Posting-Host: ara-il1-02.ix.netcom.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Mailer: Mozilla 4.01 [en] (Win95; I) X-Priority: 3 (Normal) > Ok, now my sprites are happily displaying and rotating, but > now I'm trying > to figure out how to use the built-in functions to make one point > orbit > another point. I need the sprite that represents my turret to orbit > around > the center of my tank sprite as the tank rotates. > I thought I'd store the current position of the turret in an > SVECTOR, use > ApplyMatrixSV() and RotMatrixZ() to perform the appropriate > calculations, > then store the results back into the GsSPRITE structure. But > where/how do > I tell such an algorithm where the center of the tank is? > Am I heading in the right direction with this, or is there an > easier/faster way to go about this? I don't think you'd need anything as complex as matrix math to do something like this. All you need is two sprites of the same size. One sprite is your tank, and the other is the turrent. Rotate the turrent, and draw it under or over the tank. You can then draw another sprite above all of them to make the turrent look like it's built into the tank. As long as both the turrent sprite and the tank are the same size, the turrent will always appear to rotate around the center. People tell me that I don't explain things too well, so just say the word and I'll spend 5 minutes making a quick demonstation program... Manny Najera