First of all I must say it worked BUT I was trying to use a Sphere as the custom cursor . Using Sphere I was getting an effect in which when moving the Sphere it was starting to zoom in at me and finally inflating and dissapearing behind the camera's view . But when I used a DofSprite2D it did work good . Actually I need this functionality for the game I am working on . I have got a 3d room and in it's floor there are holes . Occasionally pop up from these holes different objects and the player should smash them with a hammer . I want this hammer to be a 3d Object and actually to be attached to the mouse cursor .and because the environment is 3D I want the hammer to get z depth when it goes for a farthest hole on the floor .
On Sun, Jul 19, 2009 at 10:34 PM, ben <[email protected]> wrote: > > Hi sasMaster. > Most of time this works like this : > In fact you can imagine that you're gonna project your mouse x/y > coordinate at a certain distance using the camaera perspective, > a kind of ray from your mouse. > > var ray:Number3D = view.camera.unproject(view2.mouseX, view2.mouseY); > ray.add(ray, view2.camera.position); > ray. > > but now you have to deal with at wish z level you want your mouse to > act, and this delas more with what you're trying to achieve. > tell me more : get intersection with object, draggin, look at mouse > position, etc ???? > > anyway, if you want a custom 3d cursor, and you want to place it where > the interaction appens, I suggest you to use the e.sceneX,e.sceneY and > e.sceneZ of a MoseEvent3D : > when adding a mouseEvent3D you can retrun the position in the 3D space > where your mouse is projected. > ex : > scene.addOnMouseMove(posTest); > > function posTest(e:MouseEvent3D):void > { > your false cursor must be an Object3D, this can be for example a > dofSprite or any billboard object. > cursor.x = e.sceneX; > cursor.y = e.sceneY; > cursor.z = e.sceneZ; > cursor.moveBackWard(10); /// to keep a distance from the surface > } > > > >
