Game Development Community

Seperation of objectTypes

by Ronald J Nelson · in Game Mechanics Kit · 09/29/2009 (7:40 pm) · 1 replies

I found this helpful when using the GMK with my weapons resource as well as a few others. Using the GMK physics objects as VehicleObjectType objects causes detection issues in some cases with other addons and resources.

In T3D/objectTypes.h around line 72 change to read like this
ShadowCasterObjectType =	BIT(28),
   RigidBodyObjectType  =        BIT(29)

In T3D/gameFunctions.cpp right after line 468 add before the closing brace
Con::setIntVariable("$TypeMasks::RigidBodyObjectType",	   RigidBodyObjectType);

In T3D/vehicles/flyingVehicle.cpp change the sCollisionMoveMask declaration to this
const static U32 sCollisionMoveMask = (TerrainObjectType        | InteriorObjectType   |
                                       WaterObjectType          | PlayerObjectType     |
                                       StaticShapeObjectType    | VehicleObjectType    |
                                       VehicleBlockerObjectType | StaticTSObjectType   |
                                       AtlasObjectType | RigidBodyObjectType);

In T3D/vehicles/hoverVehicle.cpp change the sCollisionMoveMask declaration to this
const U32 sCollisionMoveMask = (TerrainObjectType        | InteriorObjectType   |
                                PlayerObjectType         | StaticTSObjectType   |
                                RigidBodyObjectType  |
                                StaticShapeObjectType    | VehicleObjectType    |
                                VehicleBlockerObjectType | AtlasObjectType);

In T3D/vehicles/wheeledVehicle.cpp change the sClientCollisionMask declaration to this
const U32 sClientCollisionMask = (AtlasObjectType       |  TerrainObjectType     |
                                  InteriorObjectType    |  StaticShapeObjectType |
                                  VehicleObjectType     |  PlayerObjectType      | 
                                  StaticTSObjectType | RigidBodyObjectType);

In T3D/item.cpp change the sClientCollisionMask declaration to this
static U32 sClientCollisionMask =
      TerrainObjectType    | InteriorObjectType       |
      PlayerObjectType     | StaticShapeObjectType    |
      VehicleObjectType    | VehicleBlockerObjectType |
      StaticTSObjectType   | AtlasObjectType          |
	  RigidBodyObjectType;

In T3D/player.cpp change the sCollisionMoveMask declaration to this
static U32 sCollisionMoveMask = (AtlasObjectType        | TerrainObjectType    |
                                 InteriorObjectType     |
                                 WaterObjectType        | PlayerObjectType     |
                                 RigidBodyObjectType  |
                                 StaticShapeObjectType  | VehicleObjectType    |
                                 PhysicalZoneObjectType | StaticTSObjectType);

In T3D/projectile.cpp change the csmDynamicCollisionMask declaration to this
const U32 Projectile::csmDynamicCollisionMask = PlayerObjectType        |
                                                VehicleObjectType       |
												RigidBodyObjectType    |
                                                DamagableItemObjectType;

In T3D\logickingMechanics\physics\ragDoll.cpp change line 108 to
mTypeMask |= RigidBodyObjectType;

Finally in T3D\logickingMechanics\physics\rigidBody.cpp change line 95 to
mTypeMask |= RigidBodyObjectType;

Then just clean and compile. I hope this helps others as much as it does me.