RigidShape collision issues
by William Swilling · in Torque Game Engine · 01/09/2010 (9:26 pm) · 6 replies
I posted this on the T4Wii forum, but since this is a general TGE issue, I will ask here.
RigidShape collision detection doesn't seem to work properly with scaled objects. The RigidShape will collide correctly with an object's collision meshes as long as they are not scaled, but scale either one and the detections become irregular. This appears to be a known limitation of the TGE which I've found a few threads about, but I haven't been able to find any solutions. The problem appears to be in the preparation of the inverse matrices in Convex::findClosestState. Has anyone got any kind of workable solution?
RigidShape collision detection doesn't seem to work properly with scaled objects. The RigidShape will collide correctly with an object's collision meshes as long as they are not scaled, but scale either one and the detections become irregular. This appears to be a known limitation of the TGE which I've found a few threads about, but I haven't been able to find any solutions. The problem appears to be in the preparation of the inverse matrices in Convex::findClosestState. Has anyone got any kind of workable solution?
#2
Note: I have seen some places in things like the Player collision code uses getScale() in calls related to the convex object. Maybe RigidShape doesn't bother using scale in those calls?
01/11/2010 (6:12 am)
It does seem like scaling support is a little dodgy in Torque, at least when it comes to collision. Do you really need to have dynamically scaling items - is it a situation where they can't be two separate objects?Note: I have seen some places in things like the Player collision code uses getScale() in calls related to the convex object. Maybe RigidShape doesn't bother using scale in those calls?
#3
@Daniel - RigidShape does use getScale when it retrieves the convex meshes in findClosestState and getCollisionInfo. I think the problem lies with the way it finds the distance between two convex meshes not being scalable. Anyway, I needed this because I have a mini forest with a bunch of tree objects scaled to different sizes. I am using these as obstacles for a RigidShape variant that is being thrown through them. It would use up too much storage memory for my artist to create a separate shape file for each scale of tree that he uses.
01/11/2010 (11:58 am)
@Thomas - no, it is not the same issue. RigidShape handles collisions in a completely different fashion than does the Item class.@Daniel - RigidShape does use getScale when it retrieves the convex meshes in findClosestState and getCollisionInfo. I think the problem lies with the way it finds the distance between two convex meshes not being scalable. Anyway, I needed this because I have a mini forest with a bunch of tree objects scaled to different sizes. I am using these as obstacles for a RigidShape variant that is being thrown through them. It would use up too much storage memory for my artist to create a separate shape file for each scale of tree that he uses.
#4
I just did some tests in T3D (rigidShape class should be about the same) and actually had my objects perform better than expected on two test cases: giant static shape rifles, scaled to 10x normal size and an interior (.dif) obj also scaled to 10x. A few times they went through surfaces, but that's honestly just to be expect with the Rigid class. To minimize this effect, reducing the amount of plane/plane collision helps a lot (use rounded collision meshes instead of boxes). The more often you're getting vertex->whatever collisions, the less likely objects are to sink.
Aside from that I can't help you.. I gave up on the Rigid class long ago and moved to Bullet and PhysX. I believe there are resources for both PhysX and ODE that work with TGE, but I doubt you can make that play nice on the Wii.
Tomorrow I'll dig out my copy of TGE and see if anything changed in rigidShape between then and T3D that might have fixed your problem, and hopefully post anything I find without actually revealing any specific T3D code. :P
01/12/2010 (6:20 am)
By any chance are these trees created with a shapeReplicator? The collisions generated by the replicator were always broken at best if I recall my time with TGE correctly, especially if you used any scaling options.I just did some tests in T3D (rigidShape class should be about the same) and actually had my objects perform better than expected on two test cases: giant static shape rifles, scaled to 10x normal size and an interior (.dif) obj also scaled to 10x. A few times they went through surfaces, but that's honestly just to be expect with the Rigid class. To minimize this effect, reducing the amount of plane/plane collision helps a lot (use rounded collision meshes instead of boxes). The more often you're getting vertex->whatever collisions, the less likely objects are to sink.
Aside from that I can't help you.. I gave up on the Rigid class long ago and moved to Bullet and PhysX. I believe there are resources for both PhysX and ODE that work with TGE, but I doubt you can make that play nice on the Wii.
Tomorrow I'll dig out my copy of TGE and see if anything changed in rigidShape between then and T3D that might have fixed your problem, and hopefully post anything I find without actually revealing any specific T3D code. :P
#5
01/12/2010 (8:17 am)
I've actually been dealing a bit with Rigid lately and haven't found it all that bad... for things like shooting barrels around it's been fairly stable, if not the best physics solution around. The best bit is that it's networked, of course.
#6
01/12/2010 (11:35 am)
@Henry - no, I am trying to collide a RigidShape derived object with manually placed TSStatic objects using the same shapefile but scaled individually. As I said before, I am limited to the amount of storage space I can use. Therefore, I cannot have a separate dts. for each scale of each object.
Torque 3D Owner Thomas Huehn
www.torquepowered.com/community/forums/viewthread/77465