Dirk,

Quoting Dirk Reiners <[EMAIL PROTECTED]>:

>
>       Hi Toni,
>
> On Wed, 2005-08-17 at 14:13 +0200, [EMAIL PROTECTED] wrote:
> > [...]
>
> The problem is that the beacon is on top of your objects. That's the way
> to do camera-relative objects (as the object is in the same coordinate
> system as the camera resp. its beacon). Give the beacon a separate Node
> (it doesn't even have to be in the scenegraph) and things should work.
>
> Alternatively you can use a MatrixCamera, which directly takes modelview
> and projection matrix. Word of warning: OpenSG's MatrixLookAt is
> designed for OpenSG and gives you the inverse of OpenGL's lookat.
>
> Hope it helps
>
>       Dirk

yes it helped, thank you! Hope I used it as it is supposed to be used...

For the archive:

//[...]

    TransformPtr CamTrans;
    CamTrans = Transform::create();

        beginEditCP(CamTrans);
                Matrix lookAtMatrix;
                osg::MatrixLookAt( lookAtMatrix, 0, 0, -100, 1, 0, 0, 0, 1, 0 );
                CamTrans->setMatrix(lookAtMatrix);
        endEditCP(CamTrans);


        rootScene = Node::create();

    beginEditCP(rootScene, Node::CoreFieldMask | Node::ChildrenFieldMask);
    {
        rootScene->setCore(CamTrans);
        rootScene->addChild(scene);
    }
    endEditCP  (rootScene, Node::CoreFieldMask | Node::ChildrenFieldMask);


        NodePtr beaconNode = Node::create();

        beginEditCP( beaconNode );
                beaconNode->setCore(Transform::create());
        endEditCP( beaconNode );

    PerspectiveCameraPtr camera = PerspectiveCamera::create();
    beginEditCP(camera);
        camera->setBeacon( beaconNode );
        camera->setFov( deg2rad( 60 ) );
        camera->setNear( 0.5 );
        camera->setFar( 8000 );
    endEditCP(camera);

//[...]

    beginEditCP(vp, Viewport::CameraFieldMask );
        {
                vp->setCamera( camera );
        }
    endEditCP(vp, Viewport::CameraFieldMask);


----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.


-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
Opensg-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-users

Reply via email to