I'm working on this project for about 2 weeks now i first used the collisionExample.fla but if i needed to adjust the map i couldnt get it working properly. My class uses a simple bitmap and checks for the color. The calculations are the same as in the collisionExample.fla but instead of checking the collision of the camera i'm checking the collision of the dot on the map :). If there is a collision i dispatch a custom event and reset the camera/ cone/2d player to the old position.
You can find the UserMap and CollisionEvent classes here :http:// labs.speak.nl/3d/away3d/demo14/src/collision.rar It's used like this: //CREATE MAP var userMap:UserMap = new UserMap(yourmapbitmapdata); this.addChild(userMap); userMap.addEventListener(CollisionEvent.COLLISION,onCollision,false, 0,true); //RENDER ON ENTERFRAME private var render(event:Event):void{ var xpos:Number = (camera.x / (envWidth / userMap.width)) + userMap.width / 2; var ypos:Number = -(camera.z / (envHeight / userMap.height)) + userMap.height / 2; var playerPoint:Point = new Point(xpos, ypos); userMap.position = playerPoint } //COLLISION private function onCollision(event:CollisionEvent):void { trace("collision") } On 9 nov, 22:02, ColouredFunk <colouredf...@googlemail.com> wrote: > Wow that must have taken ages! I've been pulling my hair out over > this. Have you checked out the collisionmapExample.fla in the files? > > It's got some good easy collision detection on it. I've tried it and > it works well, apart from the fact I can't get it to resolve the > camera position after a collision....!! :s > > > > On Monday, November 9, 2009, dp <mrdavepen...@googlemail.com> wrote: > > I did it purely through trial and error, making an adjustment to the > > image, loading it up and checking the collision. I'm sure there must > > be a better way though. > > > On Nov 9, 5:49 pm, ColouredFunk <colouredf...@googlemail.com> wrote: > >> How so you debug it though as you can't see how it's using the map..? > > >> On Monday, November 9, 2009, dp <mrdavepen...@googlemail.com> wrote: > >> > Yeah, I've adapted it for a couple of examples. I too had problems > >> > with it crashing, I seem to remember just rotating the image solved > >> > that problem. Then once it is loading keep making adjustments to the > >> > image until it works well with your floorplan > > >> > On Nov 9, 5:27 pm, ColouredFunk <colouredf...@googlemail.com> wrote: > >> >> Hey Davivd, > > >> >> I'm trying to adopt the collision detection from the frustum hotel > >> >> example too, did you have any luck changing it for different room > >> >> positions/sizes.. > > >> >> It keeps on crashing out on me when I try and change anything on it.. > > >> >> Thanks in advance > > >> >> On Monday, November 9, 2009, dp <mrdavepen...@googlemail.com> wrote: > >> >> > Thanks for those suggestions, both could be suitable for the job. Do > >> >> > you know if it possible to import my 3ds mesh into JigLibFlash and > >> >> > have it produce the equivalent, or would I need to code a > >> >> > representation of it using the primitives? > > >> >> > On Nov 6, 2:10 pm, Li <paleblue...@gmail.com> wrote: > >> >> >> You could plug JigLibFlash to Away3D. It is a 3D physics engine and > >> >> >> it can > >> >> >> manage collisions between cubes, spheres, cylinders, etc. For every > >> >> >> mesh > >> >> >> that you want to be physically active, you'll need to produce an > >> >> >> equivalent > >> >> >> in the physics engine. From there on JigLibFlash relates them to > >> >> >> each other. > > >> >> >> I also made an article about simple bounding box collision > >> >> >> detectionhttp://www.lidev.com.ar/?p=295 > >> >> >> but it does not resolve collisions, simply detects them. If you feel > >> >> >> like > >> >> >> developing though, you could see how to make the response.