Re: [Plib-users] Intersection Testing / 3ds loading
Brought to you by:
sjbaker
|
From: Steve B. <sjb...@ai...> - 2001-09-05 17:08:46
|
> Thomas Gahr wrote:
>
> I am writing a game with PLIB it's a kind of 3d jump n run (like "tux a quest fo herring"). First I used heightmaps (modified majik-example), but now I wanted to use models for my terrain.
> I made some models using anim8or and tried to load them.
What file format does anim8or write?
> Most of them were white, although I applied materials and if i applied textures
> they were stretched over the whole model (but I think that's a problem in anim8or).
...or the PLIB file loader for whatever format you are using.
> Can I apply states to ssgEntities?
No - only ssgLeaf nodes.
> How can I modify the VtxTables (or whatever the loader uses to store
> the veritces) of the model I loaded?
RTFM! There is API for ssgVtxTable that allows access to the vertex tables
themselves.
> Now (that I have models for the terrain with some walls and steep planes) I wanted to use the
> LOS-intersection testing for checking if I am running against a wall.
TuxAQFH and TuxKart both use bounding sphere intersection tests for that - it works much better
than the alternatives.
> Then I tried the Isect-method with a sphere:
>
> sgVec3 test_vec ;
> sgMat4 invmat ;
> sgMakeIdentMat4 ( invmat ) ;
> sgSphere *sphere;
>
> invmat[3][0] = -pos[0] ;
> invmat[3][1] = -pos[1] ;
> invmat[3][2] = -(pos[2]+1.5) ;
>
> sphere = new sgSphere;
>
> sphere->setCenter(0.0,0.0,1.2);
> sphere->setRadius(1.0);
>
> ssgHit *results ;
> int num_hits = ssgIsect ( tscene, sphere, invmat, &results ) ;
>
> float ehot = -1000000.0f ;
>
> for ( int i = 0 ; i < num_hits ; i++ )
> {
> ssgHit *eh = &results [ i ] ;
>
> float ehgt = - eh->plane[3] / eh->plane[2] ;
> if ( ehgt >= ehot )
> ehot = ehgt ;
> }
> The Program crashes when I increase the sphere's radius
That's rather suprising - where exactly does it die?
----------------------------- Steve Baker -------------------------------
Mail : <sjb...@ai...> WorkMail: <sj...@li...>
URLs : http://web2.airmail.net/sjbaker1
http://plib.sf.net http://tuxaqfh.sf.net http://tuxkart.sf.net
http://prettypoly.sf.net http://freeglut.sf.net
http://toobular.sf.net http://lodestone.sf.net
|