Game Development Community

T3D 1.1 Beta 3 - Forest editor objects with two collision meshes do not support player collisions on second collision mesh - RESOLVED

by Steve Acaster · in Torque 3D Professional · 10/04/2010 (6:32 pm) · 6 replies

T3D 1.1 Beta 3

Win7 32-bit

target
Forest Editor -> model Collision nodes/meshes

Issue
Pretty sure this isn't me screwing up ... a standard object with 2 collision meshes stops both projectile and player, but when it's created using Forest Editor, the 2nd collision mesh only stops projectiles and not players. Not tried it on meshes with more than 2 collision nodes/meshes.

Repeat
Make a model with 2 collision meshes (as colBox-1 and colBox-2 under respective nodes Collision-1 and Collision-2), paint them into the level as Forest Editor objects and shoot and run into them in-game. Collision-2(colBox-2) stops projectiles but doesn't collide with players.

Suggest
Collision-2 should act like Collision-1

08APRIL2011 FIXED IN 1.1 PREVIEW

#1
10/05/2010 (1:45 am)
I'm not sure, but I think this could be a broader issue. I have a StaticShape that has a number of Collision-x meshes and only some of the Collision meshes seem to trigger with vehicles. I don't have a problem with player collisions however.
#2
10/07/2010 (2:19 pm)
Logged as TQA-1169 for the QA team to verify.
#3
10/11/2010 (6:40 pm)
I have the same issue here. Col-2 doesn't collide with player. Adding the mesh as a StaticShape and the player will collide with Col-2.
#4
02/09/2011 (11:24 am)
Greetings!

This one took a bit of tracing through the engine, but the solution ended up being fairly simple. The issue was in Forest::buildConvex() where it checks if a collision mesh has already been added to the working set. The comparison checks against the Forest and ForestItem, but failed to also check against the collision detail's index. This meant that the first collision detail was added to the working set, but all subsequent collision details were skipped.

Here's my change to part of Foreset::buildConvex():

// See if this convex exists in the working set already...
         Convex* cc = 0;
         CollisionWorkingList& wl = convex->getWorkingList();
         for ( CollisionWorkingList* itr = wl.wLink.mNext; itr != &wl; itr = itr->wLink.mNext ) 
         {
            if ( itr->mConvex->getType() == ForestConvexType )
            {
               ForestConvex *pConvex = static_cast<ForestConvex*>(itr->mConvex);

               if ( pConvex->mObject == this &&
                  pConvex->mForestItemKey == forestItem.getKey() &&
                  pConvex->hullId == j )
               {
                  cc = itr->mConvex;
                  break;
               }
            }
         }
         if (cc)
            continue;

I added in the pConvex->hullId == j check around line 220. This change is now in 1.1 Final.

- Dave
#5
02/09/2011 (12:11 pm)
Works for me, Dave. Good fix.
:)
#6
04/12/2011 (6:15 pm)
Fixed in 1.1 Final and Preview.