I just posted the source for a project I'm working on, and I think you might find some of it useful.
I've set up a really simple ball-firing class that spawns a ball and gives it direction and speed based on where the camera is looking. It's for Away3D4, but if you're not using that I'm sure you could replace a couple of methods and it will work. http://groups.google.com/group/away3d-dev/browse_thread/thread/519b4147e6a5875d# On Mar 17, 9:04 am, pokey <[email protected]> wrote: > Many thanks. I'd like to eventually have non-constant speed > projectiles, but I think nailing down the constant speed case will be > a good first step. > > Coincidentally, I've been glancing at that book's preview via google > books, and have it ordered on Amazon. > > On Mar 17, 6:45 am, Michael Iv <[email protected]> wrote: > > > > > > > > > There is an issue with detecting collision on the bodies travailing very > > fast.In a regular way it may occur that at the next collision test the > > object (bullet ) is already past the collision point. For this CCD is the > > solution .Ray is a simplest solution however. You cast it in the direction > > of the bullet path.You get the hit ( the distance to the collision point) > > .Assuming that the travel time is CONSTANT ray model works fine .Because in > > this case you get the exact time of the hit and have an ability to predict > > the impact.If the speed is changing or the impacted object is dynamic you > > should better got CCD solution.It really depends on if you want to have a > > physical behavior of the projectile becasue in this vase you should take > > into account (acceleration,gravity ,drag forces etc) or just a simple bullet > > constant speed model which would be pretty easy to simulate."Physics for > > Game Programers" book is very nice resource to learn this stuff. > > > On Thu, Mar 17, 2011 at 3:34 PM, Arkadianen <[email protected]> wrote: > > > How CCD differs from collision iteration? > > > Can we calculate collisions in GPU ? What other operations can be made > > > in GPU? > > > > On Mar 16, 10:05 pm, Michael Iv <[email protected]> wrote: > > > > Usually in fps shooters ray is used to get hit position . Another method > > > for bullets hit test is CCD ( continuous collision detection ) . It can be > > > used with rays or on it's own . Google for the exact implementation . If I > > > recall right Seb Lee had an example on his blog . Also check JigLib may be > > > it has got built in CCD > > > > > Sent from my iPhone > > > > > On Mar 16, 2011, at 9:02 PM, pokey <[email protected]> wrote: > > > > > > Hi there, > > > > > > I'm new to Away3D, and trying to create an oh so simple little > > > > > shooting gallery: it will have a plane with some cubes scattered on > > > > > it, and you will use the mouse as a crosshair to fire projectiles at > > > > > the cubes, from a vantage point hovering over the plane. > > > > > > My hangup is getting the projectile firing, and testing whether it > > > > > hits a target (the cubes, or the plane itself). I'll have some > > > > > function defining the position of the projectiles as a function of > > > > > time and where the crosshairs were aimed when they were released. At > > > > > this point, I could just have iterate through every cube (and the > > > > > plane) at each frame testing if one of the projectiles has collided > > > > > with it. I'm wondering if anyone could suggest a simpler way to > > > > > proceed utilizing some Away3D libraries? The getIntersect() method in > > > > > Ray.as looks promising, though it's not completely clear to me what > > > > > this does (nor can I find much documentation). > > > > > > Cheers, > > > > > P > > > -- > > Michael Ivanov ,Programmer > > Neurotech Solutions Ltd. > > Flex|Air |3D|Unity|www.neurotechresearch.comhttp://blog.alladvanced.net > > Tel:054-4962254 > > [email protected] > > [email protected]
