Re: Moving objects
Mario Veraart (rioj7++at++fel.tno.nl)
Tue, 28 Jul 1998 20:37:50 +0200 (MET DST)
>
> 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
The way you can do it is as follows:
Load the car with a separate call to pfdLoadFile() and connect it to
the scene with a pfDCS node.
Put the path you have found in the polyline into the pfuPath tools of
Performer. With this tool you can set speed and curve radius of an
object moving along the path.
Once you start the path you just put the coordinates returned into the
pfDCS and your car is moving.
You have to do this for every car that is driving around in the scene.
You are not able with the current
pfuPath to let the car stop in front of traffic lights and such. But
the source code is available and you can modify it to your own needs.
Mario
=======================================================================
List Archives, FAQ, FTP: http://www.sgi.com/Technology/Performer/
Submissions: info-performer++at++sgi.com
Admin. requests: info-performer-request++at++sgi.com
This archive was generated by hypermail 2.0b2
on Mon Aug 10 1998 - 17:57:45 PDT