Game Development Community

Linking" interiors...

by Maddermadcat · in Torque Game Engine · 04/16/2007 (1:32 pm) · 2 replies

I'm in need of assistance... Basically, I want to set up RTS-like interiors that the player can enter. Anyway, long story short, how can I link collisions with interiors to "controller" objects?

Be kind and help a newbie. =P Thanks in advance.

#1
04/16/2007 (5:50 pm)
Hey Maddermadcat, are you familiar with the ::onCollision() script routine associated with the player/projectile/shape objects?

function Armor::onCollision(%this,%obj,%col)
{
   if (%obj.getState() $= "Dead")
      return;

   // Try and pickup all items
   if (%col.getClassName() $= "Item")
      %obj.pickup(%col);

   // Mount vehicles
   [b]%this = %col.getDataBlock();
   if ((%this.className $= WheeledVehicleData) && %obj.mountVehicle &&
         %obj.getState() $= "Move" && %col.mountable) {[/b]

      // Only mount drivers for now.
      %node = 0;
      %col.mountObject(%obj,%node);
      %obj.mVehicle = %col;
   }
}

See the bold code? You'll want to mimic that process:

if(%this.className $= InteriorInstance)
       doPlayerInteriorInteraction();

Now, that should handle your actual collision. What you put in doPlayerInteriorInteraction (or whatever you name your function), depends on a lot of different ideas. You could hide the units that collide and save their position as a reference for later use.

Are you trying to obtain the same game play mechanics as found in Command and Conquer 3 and its successors?
#2
04/16/2007 (7:00 pm)
No, actually Command & Conquer Renegade (if you've played that). Buildings that can be 'disabled,' but don't disappear from the mission for understandable reasons. =)