Collidegrnd and DCS questions

New Message Reply Date view Thread view Subject view Author view

Hideo MIKI (miki++at++msys0.ihimsys.ihi.co.jp)
Tue, 7 Mar 95 17:16:41 JST


These are the questions:

1.
 I've been trying to get a data of heightaboveterrain (from View to terrain)
in a modified perfly,the code goes like this(I insert this code into main.c):
        /** calculate heightaboveterrain **/
        pfuGetXformerCoord(ViewState->xformer,icoord);
        grndNode = (pfNode *)ViewState->scene ;
        if ((CollideGrnd (&icoord,grndNode,zpr)) != 0 )
                        printf ( "z[0] = %f\n",zpr[0]);

When I run this code, I cannot get z[0] data. (Segmentation fault)
 In this code,CollideGrnd likes pfuCollideGrnd function(return zpr value).

   ---------------------------------------------------------
2.
   I'm trying to move moving-models in a modified perfly.The code like
  this(I append this code into perfly.c(initSceneGraph) and main.c):

perfly.c

  long
   initSceneGraph(....)
      :
      :
    /* Load the file */
        if ((node1 = LoadFile("boat.flt", NULL)) == NULL)
                {
                    pfExit();
                    exit(-1);
                }
   /* Create the node */
        ViewState->sceneDCS = pfNewDCS();
        ViewState->sceneGroup = pfNewGroup();

    /* Create the hierarchy */
        pfAddChild(ViewState->scene, ViewState->sceneDCS);
        pfAddChild(ViewState->sceneDCS, ViewState->sceneGroup);
        pfAddChild(ViewState->sceneDCS, node1);

main.c
       :
       :
      pfFrame();
      PostFrame();
        /* moving-model-position */
  pfCoord *mm1;
        mm1->xyz[0] = ViewState->xformer->coord.xyz[0] + 10;
        mm1->xyz[1] = ViewState->xformer->coord.xyz[1] + 50;
        mm1->xyz[2] = ViewState->xformer->coord.xyz[1] - 50;
        mm1->hpr[0] = ViewState->xformer->coord.hpr[0] ;
        mm1->hpr[1] = ViewState->xformer->coord.hpr[1] ;
        mm1->hpr[2] = ViewState->xformer->coord.hpr[2] ;
        pfDCSCoord(ViewState->sceneDCS,mm1);
        :

  I cannot make boat model in my display.
  Can anyone help and point out what is wrong?

Thanks for any help.
                        Hideo Miki


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:51:02 PDT

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