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.programming.3d_graphics Subject: Matrix Problems Date: 20 Nov 1997 18:01:44 -0000 Organization: Sony Computer Entertainment Europe - 119.SS5 Lines: 37 Sender: news@chuka.playstation.co.uk Message-ID: <651tu8$cs71@emeka.playstation.co.uk> Reply-To: Lewis_Evans@Playstation.sony.com NNTP-Posting-Host: emeka.playstation.co.uk From: Lewis_Evans@Playstation.sony.com To: news@playstation.co.uk Here is a problem for the mathematicians among you. If I have 2 objects each with their own coordinate matrix, and I want them to orient towards each other, how do I do it? I can calculate the angles between them on the 3 axes, but then I presume its not as simple as doing a linear interpolation of the matrices because mathematically that just doesn't look right... Ideas? If you want them each to turn to point towards the other, this can be achieved by each doing the same thing concurrently. Eg for 2 ships A and B, consider A first; express the world position of B in A's local coordinate system, and then make A rotate around its own axis until B is 'dead ahead' ie the position of B in A's coordinate space is (close to ) a vector (0, 0, k). If each does this concurrently, they'll end up looking right at each other. Making them fully aligned (so that they both agree where up is) is just about each doing theta-Z rotation until their y-axes agree (are the same in world coordinate space). In the SCEE demo 'flying', some of the later tutoN programs show enemy ships that turn towards you and fire at you; they use this method. Lewis