Increasing Number of Max Collision Meshes
by Shawn Simas · in Torque Game Engine · 08/28/2004 (11:45 pm) · 20 replies
I'm trying to have hitboxes that work off of collision meshes on a player, this way its easier to set up since you can do it right in your modelling program, and it will also allow you have to have them shaped differently.
Now, the first problem I ran into was trying to figure out how to increase the number of collision meshes? I looked through the engine code, and all of the forums/resources but just couldn't find anything.
If anyone can help me out it would be greatly appreciated!
Thank you
Shawn
Now, the first problem I ran into was trying to figure out how to increase the number of collision meshes? I looked through the engine code, and all of the forums/resources but just couldn't find anything.
If anyone can help me out it would be greatly appreciated!
Thank you
Shawn
#2
08/29/2004 (8:09 am)
Thank you ever so much! just what I needed.
#3
If anyone else has done this please post some tips!
Imma keep digging...
08/29/2004 (9:18 pm)
Dang. I changed both of these to 16 and now it crashes at startup... If anyone else has done this please post some tips!
Imma keep digging...
#4
First it's defined in shapebase.h at line 378
and again at tsStatic.h at line 67
also in shapebase.h collisionDetails is defined as
collisionDetails[8];
while in tsStatic.h it's defined as so...
mCollisionDetails[MaxCollisionShapes];
mCollisionDetails in shapebase.h should probably be set the same way as tsStatic using the maxCollisionShapes variable as well.
Last thing to consider is changing line 478 in shapebase.h
S32 LOSDetails[8];
08/29/2004 (10:15 pm)
MaxCollisionShapes is actually defined twice in the engine, and I'm not sure this is a very good idea.First it's defined in shapebase.h at line 378
and again at tsStatic.h at line 67
also in shapebase.h collisionDetails is defined as
collisionDetails[8];
while in tsStatic.h it's defined as so...
mCollisionDetails[MaxCollisionShapes];
mCollisionDetails in shapebase.h should probably be set the same way as tsStatic using the maxCollisionShapes variable as well.
Last thing to consider is changing line 478 in shapebase.h
S32 LOSDetails[8];
#5
do you use VC++ or any other IDE ?? Try a search in files (over the whole TGE Project).
In TSstatic.h and TSstatic.cc there are some more "MaxCollisions"
[code TSstatic.h]
class TSStatic : public SceneObject
{
typedef SceneObject Parent;
friend class TSStaticConvex;
static U32 smUniqueIdentifier;
enum Constants {
MaxCollisionShapes = 8
};
[/code]
and maybe there will be some more stuff like this in the DTS loading functions.
[edit]
ups, next time i have to refresh before posting ;-)
[/edit]
08/29/2004 (10:29 pm)
Shawn, do you use VC++ or any other IDE ?? Try a search in files (over the whole TGE Project).
In TSstatic.h and TSstatic.cc there are some more "MaxCollisions"
[code TSstatic.h]
class TSStatic : public SceneObject
{
typedef SceneObject Parent;
friend class TSStaticConvex;
static U32 smUniqueIdentifier;
enum Constants {
MaxCollisionShapes = 8
};
[/code]
and maybe there will be some more stuff like this in the DTS loading functions.
[edit]
ups, next time i have to refresh before posting ;-)
[/edit]
#6
Now, it's a problem in tsMesh during the getFeatures.
There's a PlaneF() in there which is calling the
AssertFatal(squared != 0.0, "Error, no plane possible!"); in mPlane.h
I just woke up and have to run, so i can't really look into it yet, but thanks again guys. Your all wonderful!
08/30/2004 (5:12 am)
Woo, I'm getting close, LOSDetails had to be changed as well. Now, it's a problem in tsMesh during the getFeatures.
There's a PlaneF() in there which is calling the
AssertFatal(squared != 0.0, "Error, no plane possible!"); in mPlane.h
I just woke up and have to run, so i can't really look into it yet, but thanks again guys. Your all wonderful!
#7
09/04/2004 (1:20 pm)
Sounds like a bad collision mesh.
#8
09/04/2004 (1:43 pm)
Twas... don't know why it was though, it was just a cube, but that indeed was the problem.
#9
09/06/2004 (12:03 pm)
Do not underestimate the universe's proclivity for perverseness. ;)
#10
I'm creating my collision in Max and using the DTS exporter.
Collision is working fine providing I only have one collision box.
The hieracrchy is Collision-1 as a child to start01
Col-1 is also a child of start01
Once I create more that one Collision box for every Col dummy I get no working collision.
A little guidance would be great.
Thanks
Brian
10/04/2004 (7:40 am)
Hi, has anyone encountered a problem with creating multiple collision boxes for one mesh.I'm creating my collision in Max and using the DTS exporter.
Collision is working fine providing I only have one collision box.
The hieracrchy is Collision-1 as a child to start01
Col-1 is also a child of start01
Once I create more that one Collision box for every Col dummy I get no working collision.
A little guidance would be great.
Thanks
Brian
#11
IE
Base 01 (Scene Root)
______Detail # (Corresponding detail marker)
______Collision -# (Negetive stands for NON renderable, 9 collisions -1 _ -9 by default)
______Start01 (Parent of the mesh shapes, Including the COL-#and LOSCOL-# shapes )
_____________Mesh#
_____________Col-#
_____________LOS-#
_____________?NODEs? (Bones, MountPoints, Particles ect.......)
The "base" node basically explains whats in the scene and the "Start" Node basically is the scene.
Hope that helps.
Matt
10/04/2004 (4:21 pm)
No your Collision Marker (Dummy Box) should be a child the the root of the scene.IE
Base 01 (Scene Root)
______Detail # (Corresponding detail marker)
______Collision -# (Negetive stands for NON renderable, 9 collisions -1 _ -9 by default)
______Start01 (Parent of the mesh shapes, Including the COL-#and LOSCOL-# shapes )
_____________Mesh#
_____________Col-#
_____________LOS-#
_____________?NODEs? (Bones, MountPoints, Particles ect.......)
The "base" node basically explains whats in the scene and the "Start" Node basically is the scene.
Hope that helps.
Matt
#12
07/03/2005 (1:18 pm)
So did anyone every find a solution to this? Is it possible to increase the max number of collisions?
#13
07/03/2005 (2:59 pm)
Yes, it is possible... No, I don't know off hand. I think some exporters may not check for more than 8 meshes.
#14
07/03/2005 (4:02 pm)
As of the 1.4 RC that is currently in CVS, the engine no longer has a limit on the number of collision meshes. However, like Ben said, it appears some of the exporters do not support more than 8 collision meshes (the max5 one does not but the Milkshape Plus one does for example).
#15
Does this still mean that my exporter isn't doing somthing that it should be so my mesh isn't actualy being implemented as a collision mesh or is this working and its a code problem?
(BTW I changed every instance of of 8 that was listed in this thread and had a clean compile. So in theory this should be working if I do indeed have 9 collision shapes)
thanks
07/03/2005 (5:28 pm)
Well, I am using Max 7 with the latest exporter right now. I have 9 collision meshes(just to test). Now, when I load my dts file up into the Showtool and click the "CM" button to show the collision meshes I see 1-8 of my collision meshes but not the 9th. However, if I check my shape properties it shows "collision-9" so its there but its just not showing up and its not working in the engine...Does this still mean that my exporter isn't doing somthing that it should be so my mesh isn't actualy being implemented as a collision mesh or is this working and its a code problem?
(BTW I changed every instance of of 8 that was listed in this thread and had a clean compile. So in theory this should be working if I do indeed have 9 collision shapes)
thanks
#16
07/03/2005 (6:13 pm)
Show Tool Pro only shows up to 8 collision meshes.
#17
Does this mean that my dts file has a working 9th collision mesh or did the exporter simply export these objects into the dts and not do somthing else required to implment them as collision meshes?
Basically, does this mean that it exported right and my problem is engine code related or could there still be somthing wrong with my dts file.
thanks
07/03/2005 (6:54 pm)
Ah, I was wondering if that was the case. Anyways, this is what I see in the showtool, and when I load this shape into the engine my 9th collision mesh doesn't work (all the others do). Does this mean that my dts file has a working 9th collision mesh or did the exporter simply export these objects into the dts and not do somthing else required to implment them as collision meshes?
Basically, does this mean that it exported right and my problem is engine code related or could there still be somthing wrong with my dts file.
thanks
#18
Thanks for you help so far, I hope I can get this working soon :)
07/04/2005 (3:59 am)
I was also wondering if there was any source that I could find out which exporters will recognize more than 8 collidable meshes and which will not. As I said earlier I am using Max 6 and 7 exporter.Thanks for you help so far, I hope I can get this working soon :)
#19
I have replaced every single instance of the "8 limit" I could find in the engine with 16 and successfully compiled each time. Yet, I can still take the player and walk right through the ninth collision mesh in my dts shape (though it works fine in the 1.4 RC).
07/04/2005 (5:16 am)
UPDATE: The good news is that MY DTS SHAPE WORKS! I downloaded TGE 1.4 RC off of the CVS server and the collision worked just as it should. However this now means that the problem is in modified version of 1.3. So, if someone has been able to successfully increase the maximum number of collision meshes in 1.3 it would be great if you could post and tell me how. I have replaced every single instance of the "8 limit" I could find in the engine with 16 and successfully compiled each time. Yet, I can still take the player and walk right through the ninth collision mesh in my dts shape (though it works fine in the 1.4 RC).
#20
07/04/2005 (12:44 pm)
Okay, well I recompiled and got it to work after I changed the "MaxCollision" (line: 37) in collision.h from "64" to 16.
Torque Owner Sven "RaCooN" Knie
look into shapebase.h there is "MaxCollisionShapes = 8"
[Edit]
I forgot, also in shapebase.h there are a few line after that
/// @name Collision Data /// @{ S32 collisionDetails[8]; ///< Detail level used to collide with. /// /// These are detail IDs, see TSShape::findDetail() Box3F collisionBounds[8]; ///< Detail level bounding boxes. S32 LOSDetails[8]; ///< Detail level used to perform line-of-sight queries against. /// /// These are detail IDs, see TSShape::findDetail() /// @}So take a deeper look into the shapebase classes
[/edit]