Path: chuka.playstation.co.uk!news From: "Anders Clerwall" Newsgroups: scee.yaroze.programming.2d_graphics Subject: SV: lasers?! :-( Date: Mon, 30 Nov 1998 18:36:09 +0100 Organization: PlayStation Net Yaroze (SCEE) Lines: 33 Message-ID: <73ul36$mu11@chuka.playstation.co.uk> References: <3661BAFE.FF254984@aol.com> NNTP-Posting-Host: dialup202-4-31.swipnet.se X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.00.0810.800 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.0810.800 You have a position of the laser at t=0, and you know which way your ship's facing. All you have to do is to calculate a k vector with the speed of the beam and add that to the laserbeams position every frame. At least that's how I would do it :) vector k, ship_pos(0, 0, 0), beam_pos(0, 1, 1), ship_angle(60, 0, 10); // for example vector beam_speed(0, 0, speed); // for example k=beam_speed.rotate(ship_angle.x, ship_angle.y, ship_angle.z); then for every frame do: beam_pos+=k; that should do it, now I haven't tested this since I don't have the compiler.. I really need the compiler guys!!!.. haven't gotten any response from sony. Could anyone mail me the compiler?? please.. ah well, I don't know. >i need a simple laser-firing function. i tried to use Nick F's Amateur >Wars, but that was really complicated (i'd have to change my WHOLE >control scheme). if someone could write out a simple function which >make a laser fire in the direction it was fired, that would be great. >if not, please direct me to somone's code which could help me do that. >thanks. > >:-) > >Metwally7@aol.com > >by the way, i'm using George Bain's code (ch.4--lesson 4) tutorial >(thanks George, it was a BIG help) >