Hey Colouredfunk, Good to here i could help you out:) I think the problem with the offset of the map has to do with the model your using, my target is a standard cone and everything works wel. My class does nothing with the dimensions of the target so the collision is registered from the absolute center of the target that could also be the cause of your problem. If you have ideas about new features for the classes i'm all ears :). And if your project is done and online somewhere i would love to see it.
Greetz WS On 17 nov, 14:43, colouredfunk <[email protected]> wrote: > Sorry for the delay in my reply, I managed to get a cold from > somewhere (probably working to hard)... All better now though :) > > The problem was with cameraPosition = camera.position, it was being > set to the collision position, rather than the point just before the > collision took place. > > Although I had it all in the same order as you, it just wasn't working > for some strange reason. But when I put the camera movements into a > separate method..Bingo it worked. I'm still not completely convinced > this is what was causing the problem, it now works and I'm not going > to spill more blood getting to the bottom of it. :) > > I can't thank you enough for helping me out! > > Your classes seem solid, and I didn't need to change them to get it to > work, it was more of the integration process... I did however update > your FirstPersonCamera class, as I wanted the camera look to respond > to a mouse click event, with each click relative to the current camera > pan and tilt. I can send that over if you are interesting? > > Integration aside, there is one problem I had thinking about it; and > that's getting the collision map to reflect the correct position of > the camera relative to the 3D space. I solved the problem by changing > the position of where the model was in 3Ds Max before exporting it to > a 3DS file. The two positions between the 2D and 3D world started to > line up when the model is in the middle, but I still had to offset it > slightly to get it to match perfectly. > > Have you had any problems like this? I've got quite a few rooms to do, > and that trial and error process of lining-up, to a long time. So I > wonder what the definitive solution is for that? > > Thanks again! > > On Nov 13, 2:09 pm, wsvdmeer <[email protected]> wrote: > > > > > This should work: > > > private functionr render():void { > > > //Look > > if (move){ > > camera.look() > > } > > > //Move > > if (_controls.moveForward) { > > camera.moveForward (+_controls.zspeed); > > } > > if (_controls.moveBackward) { > > camera.moveBackward(- _controls.zspeed); > > } > > if (_controls.moveLeft) { > > camera.moveLeft(- _controls.xspeed); > > } > > if (_controls.moveRight) { > > camera.moveRight (+_controls.xspeed); > > } > > > //Collision > > userMap.originalPosition = camera.position > > if (_controls.moving) { > > player2d.x = userMap.position.x > > player2d.y = userMap.position.y > > } > > > //Place camera > > camera.y = -20 > > cameraPosition = camera.position > > > //Update controls > > _controls.update() > > > //Render > > view.render(); > > > } > > > On 13 nov, 14:17, colouredfunk <[email protected]> wrote: > > > > haha no worries, it's ealisy done at the moment.. > > > > I've tried what you said, but still keeps on walking.... :s > > > > On Nov 13, 1:02 pm, wsvdmeer <[email protected]> wrote: > > > > > Hehe no posted the answer of one of your older questions:P sorry for > > > > confusing you > > > > > On 13 nov, 14:00, colouredfunk <[email protected]> wrote: > > > > > > Sorry do you mean take out : > > > > > > if (_controls.moveForward) { > > > > > camera.moveForward > > > > > (+_controls.zspeed); > > > > > } > > > > > if (_controls.moveBackward) { > > > > > camera.moveBackward(- > > > > > _controls.zspeed); > > > > > } > > > > > if (_controls.moveLeft) { > > > > > camera.moveLeft(- > > > > > _controls.xspeed); > > > > > } > > > > > if (_controls.moveRight) { > > > > > camera.moveRight > > > > > (+_controls.xspeed); > > > > > } > > > > > > when I do this, the camera does move on keypress... > > > > > > Sorry to be a paid > > > > > > On Nov 13, 12:54 pm, wsvdmeer <[email protected]> wrote: > > > > > > > Hey Colouredfunk, > > > > > > > Just keep your camera at one point: > > > > > > > function render(event:Event):void{ > > > > > > camera.look() > > > > > > camera.y = 300 > > > > > > controls.update() > > > > > > view.render() > > > > > > > } > > > > > > > On 13 nov, 13:04, colouredfunk <[email protected]> wrote: > > > > > > > > Hey, I've just realised if I look down with the mouse then > > > > > > > navigate > > > > > > > forward, the camera will actually move downwards through the > > > > > > > floor... > > > > > > > Don't know why it's doing that, as your using the MoveForward > > > > > > > methods, > > > > > > > so it should calculate it accordingly ...?... > > > > > > > > On Nov 13, 11:26 am, colouredfunk <[email protected]> > > > > > > > wrote: > > > > > > > > > genius!!! Dude, you are seriously a life saver :) > > > > > > > > > I'll let you know how I get on :) > > > > > > > > > On Nov 13, 11:09 am, wsvdmeer <[email protected]> wrote: > > > > > > > > > > Hey colouredfunk, > > > > > > > > > > I just put up a new tutorial for my firspersoncamera and > > > > > > > > > firstpersoncontrols > > > > > > > > > classes:http://wsvdmeer.blogspot.com/2009/11/away3d-firstperson-movement-and-... > > > > > > > > > > If you use these classes in combination with mycollisionclass > > > > > > > > > you > > > > > > > > > can set the controls.zspeed and controls.xpseed to 0 > > > > > > > > > oncollision. > > > > > > > > > I constantly keep track of the object i'm moving and save it's > > > > > > > > > position in a Number3D for example: > > > > > > > > > > var cameraPosition:Number3D = new Number3D() > > > > > > > > > cameraPosition = camera.position > > > > > > > > > > If acollisionoccures i reset the camera to it's old position > > > > > > > > > (cameraPosition): > > > > > > > > > > so the code would look like this: > > > > > > > > > > function onCollision(event:CollisionEvent):void{ > > > > > > > > > controls.xspeed = 0 > > > > > > > > > controls.yspeed = 0 > > > > > > > > > camera.position = cameraPosition > > > > > > > > > > } > > > > > > > > > > Hope this helps :D > > > > > > > > > > On 13 nov, 11:43, colouredfunk <[email protected]> > > > > > > > > > wrote: > > > > > > > > > > > Yeah JUST finished getting it working :) I think the > > > > > > > > > > problem was not > > > > > > > > > > having the object in 3ds Max in the middle of the > > > > > > > > > > scene...... I still > > > > > > > > > > have to have it offset slightly, but I got it working > > > > > > > > > > through a bit of > > > > > > > > > > trial and error! > > > > > > > > > > > Thanks so much for creating a class for it, really helping > > > > > > > > > > me out > > > > > > > > > > here :) > > > > > > > > > > > I've now got to sort out the camera reaction to the > > > > > > > > > > collisions :s > > > > > > > > > > > Any tips ? :o > > > > > > > > > > > Thanks again > > > > > > > > > > > On Nov 13, 10:13 am, wsvdmeer <[email protected]> wrote: > > > > > > > > > > > > Hey colouredfunk, > > > > > > > > > > > > Did it work? > > > > > > > > > > > > On 12 nov, 15:46, wsvdmeer <[email protected]> wrote: > > > > > > > > > > > > > Hey colouredfunk, > > > > > > > > > > > > > I adjusted the UserMap class and posted a tutorial on > > > > > > > > > > > > my blog > > > > > > > > > > > > :http://wsvdmeer.blogspot.com/2009/11/away-3d-2d-collision-detection.html > > > > > > > > > > > > I'm not that great at writing tutorials so if you still > > > > > > > > > > > > have a problem > > > > > > > > > > > > with the class let me know. > > > > > > > > > > > > > On 12 nov, 13:12, colouredfunk > > > > > > > > > > > > <[email protected]> wrote: > > > > > > > > > > > > > > Hey Wsvdmee, > > > > > > > > > > > > > > I've been playing out with yourcollisionclass, but I > > > > > > > > > > > > > can't get the > > > > > > > > > > > > > 2d position to aline with the 3d world... > > > > > > > > > > > > > > Have you got any idea where I could be going wrong?? > > > > > > > > > > > > > > var xpos:Number = (camera.x / (_envWidth / > > > > > > > > > > > > > _userMap.width)) + > > > > > > > > > > > > > _userMap.width / 2; > > > > > > > > > > > > > var ypos:Number = -(camera.z / (_envHeight / > > > > > > > > > > > > > _userMap.height)) + > > > > > > > > > > > > > _userMap.height / 2; > > > > > > > > > > > > > > _envWidth and _envHeight are the dimensions of the > > > > > > > > > > > > > 3ds file... > > > > > > > > > > > > > > Thanks > > > > > > > > > > > > > > On Nov 10, 4:21 pm, colouredfunk > > > > > > > > > > > > > <[email protected]> wrote: > > > > > > > > > > > > > > > Sweet thanks!!! > > > > > > > > > > > > > > > Can't wait to see it :) > > > > > > > > > > > > > > > On Nov 10, 6:30 am, wsvdmeer <[email protected]> > > > > > > > > > > > > > > wrote: > > > > > > > > > > > > > > > > Hey ColouredFunk i'll try and create a > > > > > > > > > > > > > > > FirstPersonCamera class that > > > > > > > > > > > > > > > handles the movement/look andcollisionin > > > > > > > > > > > > > > > combination with my UserMap > > > > > > > > > > > > > > > class. > > > > > > > > > > > > > > > I think i could be done by the end of the day and > > > > > > > > > > > > > > > then i'll post it > > > > > > > > > > > > > > > here. > > > > > > > > > > > > > > > > Greetz WS > > > > > > > > > > > > > > > > On 10 nov, 00:06, ColouredFunk > > > > > > > > > > > > > > > <[email protected]> wrote: > > > > > > > > > > > > > > > > > That's the bit I'm really struggerling with; > > > > > > > > > > > > > > > > the reactions / the resolves. > > > > > > > > > > > > > > > > > Msvdmeer would it be possible to share your > > > > > > > > > > > > > > > > camera movement methods > > > > > > > > > > > > > > > > with the integration of thecollisiondetection? > > > > > > > > > > > > > > > > This would really > > > > > > > > > > > > > > > > save me from going bold :) > > > > > > > > > > > > > > > > > thanks.. > > > > > > > > > > > > > > > > > On Monday, November 9, 2009, Li > > > > > > > > > > > > > > > > <[email protected]> wrote: > > > > > > > > > > > > > > > > > No, unfortunately JigLibFlash doesn't support > > > > > > > > > > > > > > > > > complex meshes yet (as far as I know) and you > > ... > > meer lezen »
