Java-Gaming.org    
Featured games (79)
games approved by the League of Dukes
Games in Showcase (477)
Games in Android Showcase (106)
games submitted by our members
Games in WIP (533)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  GeomTrimesh winding order question  (Read 999 times)
0 Members and 1 Guest are viewing this topic.
Offline odejava

Junior Newbie




Java games rock!


« Posted 2004-07-26 10:19:43 »

Im having trouble getting my collision meshes to collide properly. Im able to create a GeomTrimesh for my ground using a height map and the collisions work great. But if I load a model, for example a 3ds model with the starfire loader, and then create a collision mesh from that the collisions dont work right (ie moving objects go through it usualy).

In the java3d api if I use a TriangleArray to create the collision mesh like this:

       TriangleArray ia = //load with 3ds loader
       float[] fa = new float[ia.getVertexCount() * 3];
       ia.getCoordinates(0,fa);
       int[] index = new int[fa.length / 3];
       for(int i = 0; i < index.length; i++)
       index = i;
       //now create GeomTrimesh with fa and index

Or if I create and IndexedTriangleArray and just use the raw vertecies and index from that it still doesnt work right.

Ive even tried every possible way to reorder the winding of the triangles by swaping indexes. Nothing works. Anyone got any tips for creating GeomTrimeshes from java3d Geometrys?
Offline William Denniss

JGO Coder


Projects: 2


Fire at will


« Reply #1 - Posted 2004-07-26 10:55:47 »

Is this trimesh to be used as terrain?  Have you checked out the CarTerrainExample demo?

Will.

Offline odejava

Junior Newbie




Java games rock!


« Reply #2 - Posted 2004-07-26 11:21:05 »

No. Im creating my own IndexedTriangleArray and GeomTrimesh for my terrain. I want load arbitrary models and create collision meshes for them.
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline William Denniss

JGO Coder


Projects: 2


Fire at will


« Reply #3 - Posted 2004-07-26 23:43:57 »

I'm not 100% sure that the version of ode we are using supports non-static tri-mesh.  Also, I'm not sure if it has tri-mesh/tri-mesh support.

The better option, even if these options were supported is to approximate the shape with primitive Geoms for collission.  In my tank game, I have the tank mesh files + XODE xml files which contain the primitive approximation of the tank (and also defines the joints etc).  So my xith3d engine gets a nice mesh, ODE engine gets a few boxes.  Using tri-mesh's without good reason (terrain for example is a good reason) is not advised as you'll lose out on performance.  When you combine a few primitive Goems together you can still have quite realistic collission with complex shapes.

Will.

Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

pw (22 views)
2014-07-24 01:59:36

Riven (21 views)
2014-07-23 21:16:32

Riven (17 views)
2014-07-23 21:07:15

Riven (20 views)
2014-07-23 20:56:16

ctomni231 (48 views)
2014-07-18 06:55:21

Zero Volt (44 views)
2014-07-17 23:47:54

danieldean (35 views)
2014-07-17 23:41:23

MustardPeter (38 views)
2014-07-16 23:30:00

Cero (53 views)
2014-07-16 00:42:17

Riven (53 views)
2014-07-14 18:02:53
HotSpot Options
by dleskov
2014-07-08 03:59:08

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:58:24

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:47:22

How do I start Java Game Development?
by ra4king
2014-05-17 11:13:37

HotSpot Options
by Roquen
2014-05-15 09:59:54

HotSpot Options
by Roquen
2014-05-06 15:03:10

Escape Analysis
by Roquen
2014-04-29 22:16:43

Experimental Toys
by Roquen
2014-04-28 13:24:22
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!