Re: [info-performer] May I control FLT file with hierarchy structure

New Message Reply Date view Thread view Subject view Author view

From: Archer Chen (archerc++at++hitrontech.com)
Date: 10/07/2002 20:36:44


Hi Tze Lin,

I try to do that but I still got some problem .
I find the node by pfFindNode() to get the node I need and
rotate the node in pre-node app function.
But I can see the car in Scene without rotation.
I consider that I lose something about it. Can you give me
some suggestion?

This is my code: (using C )

int
preAppFunc(pfTraverser *trav, void *data)
{
        static float angle2 = 0.0f;
        pfDCS *tire_dcs;

        angle2 += 0.1f;
        if (angle2 > 360.0f)
          angle2 = 0.0f;

        tire_dcs = (pfDCS*)pfFindNode(pfGetTravNode(trav),
                                                        "tire",
pfGetGroupClassType());

        pfDCSRot(tire_dcs, angle2*2, 0, 0);

        return PFTRAV_CONT;
}

main()
{
        .....
        ....
        pfdConverterMode(".pfb", PFFLT_CLEAN, 0);
        pfdConverterMode(".pfb", PFFLT_FLATTEN, 0);
        shared->model.car_pmodel = pfdLoadFile("car.pfb");
        pfdConverterMode(".pfb", PFFLT_CLEAN, 1);
        pfdConverterMode(".pfb", PFFLT_FLATTEN, 1);

        pfNodeTravFuncs(shared->model.car_pmodel, PFTRAV_APP, preAppFunc,
NULL);

        shared->model.car_dcs = pfNewDCS();
        pfAddChild(shared->model.car_dcs, shared->model.car_pmodel);
        pfAddChild(shared->Scene, shared->model.car_dcs);

        ......
        .....
}

Regards,
Archer Chen

----- Original Message -----
From: "Ong Tze Lin" <tzelin++at++sgi.com>

Hi Archer,

You only need to remove the tire from the car once, in your main function.

Then, you can attach the movement code, eg some variable angle of rotation
as a function of how the user turns the steering wheel, to the tires.

-=-=-
Cheers,
Tze Lin


New Message Reply Date view Thread view Subject view Author view

This archive was generated by hypermail 2b29 : Mon Oct 07 2002 - 20:37:30 PDT

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