My camera was static so I didn't have to think about that one ;)

You could try getting the plane to match the cameras location and
rotation and then doing a moveBackward (or forward) on the plane to
offset if from the camera position.

LookAt should work - make sure that the plane has bothsides set true
as you may be looking at the back of it.

Greg

On Jul 2, 3:28 pm, robbie <[email protected]> wrote:
> Thanks a lot Greg.
> I know I probably sound a complete noob but am struggling to get a
> plane to always face the camera. I've tried setting its rotation to
> the camera's rotation and tried lookAt but neither seem to really
> work.
>
> Thanks for your help
> Robbie
>
> On Jul 2, 11:15 am, Greg209 <[email protected]> wrote:
>
> > Hey robbie,
>
> > Thanks for the comments.  There are two methods I have used and the
> > Bezier on is the worse of the two. Here are details of both....
>
> > In the bezier explorer, each vertex on the patch is represented as a
> > cube. The following event handlers  are the bits n peices that do the
> > translation.
>
> > onMouseOverVertexCube is attached to the vertex, while onMouseDown &
> > onMouseMove are attached to the stage.
>
> > When the mouse hovers over a vertex-cube it's inverseSceneTransform is
> > cloned and remembered. When the mouse down fires, it's X/Y coords are
> > remebemered. When the mouse moves, with the button down and the the
> > vertex-cube selected, the difference in mouseX/Y is calculated and
> > used in the matrix transform along with the previously stored
> > inverseScenetransform to give the vertex-cube's new position.
>
> > Unfortunately, this seems to only vaguely work - it does the job in
> > this case but I'm not sure on how well it'll work in other
> > circumstances.
>
> >                 private var cubeInvTransform:Matrix3D = new Matrix3D();
>
> >                 private function onMouseOverVertexCube( e:MouseEvent3D 
> > ):void {
>
> >                         if (!movingScene && !vertexCube) {
> >                                 vertexCube = e.target as Cube;
> >                                 
> > cubeInvTransform.clone(vertexCube.inverseSceneTransform);
> >                         }
> >                 }
>
> >                 private function onMouseDown( e:MouseEvent):void {
> >                         mousePressed = true;
> >                         baseX = mouseX;
> >                         baseY = mouseY;
> >                 }
>
> >                 private function onMouseMove( e:MouseEvent):void {
> >                         if (mousePressed) {
> >                                 var mX:int = mouseX - baseX;
> >                                 var mY:int = mouseY - baseY;
> >                                 var n:Number3D = new Number3D(-mX, mY, 0);
>
> >                                 if (vertexCube) {
> >                                         // Move the selected vertex
> >                                         n.transform(n, cubeInvTransform);
> >                                         vertexCube.x = -n.x;
> >                                         vertexCube.y = -n.y;
> >                                         vertexCube.z = -n.z;
> >                                 } else {
> >                         ...
>
> > The simpler and more accurate approach is to have a Plane in your
> > scene that always faces the camera and has such a small alpha value
> > (but not 0) that it is in effect invisible. Attached to this is a
> > mousemove event. The vertex-cube still has the mouse-over event and
> > the stage still uses the mouse down event.
>
> > This time though, when the mouse down fires, the invisible plane is
> > positioned slightly in front of the vertex-cube and becomes the target
> > for the the mousemove events. By taking the scene position of the
> > event, it can be transformed directly back to the new vertex-cube
> > (with the slight offset adjustment - 15 in this case). In this
> > example, the _wirecontainer is an object container for the vertex-
> > cubes.
>
> >                 private function onMouseOverVertexCube( e:MouseEvent3D 
> > ):void {
> >                         // Only select the vertex if nothing else happening
> >                         if (!movingScene && !vertexCube) {
> >                                 vertexCube = e.target as Cube;
> >                         }
> >                 }
>
> >                 private function onMouseDown( e:MouseEvent):void {
> >                         mousePressed = true;
>
> >                         if (vertexCube) {
> >                                 (vertexCube.material as 
> > ColorMaterial).color = _vertexSelect;
> >                                 _targetPlane.x = vertexCube.scenePosition.x;
> >                                 _targetPlane.y = vertexCube.scenePosition.y;
> >                                 _targetPlane.z = vertexCube.scenePosition.z 
> > - 15;
> >                         }
> >                 }
> >                 private function onMouseMove( e:MouseEvent3D):void {
> >                         if (_cover.visible) return;
> >                         if (mousePressed) {
> >                                 if (vertexCube) {
> >                                         // Move the selected vertex
> >                                         v.x = e.sceneX;
> >                                         v.y = e.sceneY;
> >                                         v.z = e.sceneZ + 15;
> >                                         
> > v.transform(_wireContainer.inverseSceneTransform);
> >                                         vertexCube.x = v.x;
> >                                         vertexCube.y = v.y;
> >                                         vertexCube.z = v.z;
> >                                 }
> >                         }
> >                 }
>
> > Hope that helps.
>
> > Greg
>
> > On Jul 2, 8:58 am, robbie <[email protected]> wrote:
>
> > > I was having a look at Greg's great demo of Bezier patches 
> > > (http://www.geepers.co.uk/software/bezier_patch_tutorial.html)
> > > and was wondering if anyone knows a simple way of generating draggable
> > > control nodes like he has implemented. So far the only way I see of
> > > doing it would be to generate a draggable box at each control point
> > > vertice, but was wondering if there was any built in feature to do
> > > this?
>
> > > Thanks
> > > Robbie- Hide quoted text -
>
> > - Show quoted text -

Reply via email to