Contribute to the LWJGL open collective
General Java Game Development
October 14, 2005, 23:35:39 »
i want to code a Collision Detection, the Theory are not my Problem and i allready write a function, but i think its worst as a "bad solution" so i want to ask you how this thinks solved professional.
My way. I use a 3Ds/Obj importer from a demo. in GLModel are a function which renders the Tris.
So i use a modif. Version of this. I filter the Vertexpoint with the biggest distance to PointZero out (for each Side)
Than i filter again from this 24 Vertexpoints the biggest x,y,z and -x,-y,-z
than i say x side is x+(-1)*(-x) (for y,z the same)
So now, i know every side of my Boundary Box.
It works most well (in complex Models (4000++ poly) it don't want to work correct don't know...)
ok, i hope you can help me. Thanks.
P.S.: Sorry about my English, it's not as well as it should...
Reply #1 on:
October 17, 2005, 18:42:23 »
That's a reasonable way to do it. For some really strangely shaped objects you might want to use several bounding boxes, or a combination of bounding spheres and bounding boxes.
Puppygames - Play Revenge of the Titans here!
Reply #2 on:
December 20, 2005, 17:08:20 »
Hei! I just read your post about how you are trying to implement collision detection. I am also trying to figure out how to get it working, but haven't made any progress.
My way is a bit different from yours, because I have no idea how to get the point zero of the 3D models. I am also using the class GLModel to load and to render .3ds files, but the only solution I could come up with collision detection is like this:
1.I wrote a class GameObject which has float arrays like dimension and position
2.I use glScalef(dimension, dimension, dimension) to resise the models, but there is a "small" problem when trying to rotate the objects.
3.Now I have the size and location of the object and I still haven't been able to write a working solution to detecting collisions.
Anyway I would be really happy if you could send me your code and then I could see what's the right
(Just in case I have sent a private message as well)
Reply #3 on:
December 25, 2005, 02:28:39 »
i rewrite the hole class set - inspired by the GLModel Classes, but complete new.
So the point is, when you load an 3ds File the Centerpoint 0,0 is the same it is in the 3D Modeler.
When you center the Model in the Modeler, than the Center is 0.0 in your System....
OK i didn't use that anymore. My way is to have a "Special" Model COL_BOX in the 3Ds File. (i can load multiple Models with my loader)
So i use the Vertexpoints of this model to check Collision.
SMF © 2014