Re: Moving objects

New Message Reply Date view Thread view Subject view Author view

Pete Willemsen (willemsn++at++cs.uiowa.edu)
Tue, 28 Jul 1998 13:36:13 -0500 (CDT)


Hi Andrew.

Here's a suggestion on how to incorporate the moving models into your
Performer app.

Pre-load all the flight (or whatever) files you need into your
application. For instance:

pfNode *models[ MAX_MODELS ];

models[0] = pfdLoadFile( "car0.flt" );
models[1] = pfdLoadFile( "car1.flt" );
 ...
models[n-1] = pfdLoadFile( "carn_1.flt" );

Then, when you need the appropriate flight model, say that stored in
slot i, you can clone it into the Performer tree.

pfDCS* dcs = new pfDCS();
dcs->addChild( models[ i ]->clone(0) );

// add DCS to the scene
performerScene->addChild(dcs);

And finally, when it's time to update the position of the model, you
will need to reference the particular model's DCS node and give it the
appropriate XYZ/RPY/etc... updates.

Hope that helps some.

Pete

>
> Hello to all,
>
> I have written a Performer application which will eventually evolve into
> a driving simulator, and I am currently wondering how to get some
> objects around the scene by themselves. I am using Performer2.2
> (although modelling is done in MultiGen1.4). I have a static car in the
> scene at the moment. The road has a line defined along the centre and I
> want the car to move along that line at a set speed. I have added the
> car in MultiGen, so at the moment it is lurking somewhere in the
> Performer scene graph. I have only been using Performer for a couple of
> months now but I am pretty confident with it (I think!).
>
> Anyway, I am searching the scene graph for the pfGeoSet which has the
> polyline in and I have managed to access the co-ordinates of the line
> (there are only 2 as it's a straight section of road). I have also
> calculated the correct XYZ position I want to move the car to (depending
> on the set speed) along the road. Now for my question.
>
> How do I update the co-ordinates of my "car" which is just sitting on
> the road at the moment?
> Should I not include the car in the MultiGen database, and instead add
> the object at runtime (the car is a stand alone .flt file I simply
> instanced in MultiGen)? I think this can be done.
> Or should I be searching for the car in the Performer scene graph and
> updating its transformation with my new co-ordinates? I think I will be
> needing some sort of DCS for the car anyway.
>
> Hope someone can understand all that!
> thanks,
> Andrew Bailey
>
>
>
>
> =======================================================================
> List Archives, FAQ, FTP: http://www.sgi.com/Technology/Performer/
> Submissions: info-performer++at++sgi.com
> Admin. requests: info-performer-request++at++sgi.com
>

Pete
----------------------------------------------
Pete Willemsen Department of Comp. Sci.
willemsn++at++cs.uiowa.edu University of Iowa
                      ---
http://www.cs.uiowa.edu/~willemsn
----------------------------------------------
=======================================================================
List Archives, FAQ, FTP: http://www.sgi.com/Technology/Performer/
            Submissions: info-performer++at++sgi.com
        Admin. requests: info-performer-request++at++sgi.com


New Message Reply Date view Thread view Subject view Author view

This archive was generated by hypermail 2.0b2 on Mon Aug 10 1998 - 17:57:45 PDT

This message has been cleansed for anti-spam protection. Replace '++at++' in any mail addresses with the '@' symbol.