Game Development Community

GMK Breakables

by Chris Mooney · in Game Mechanics Kit · 03/17/2011 (1:04 pm) · 0 replies

Howdy all,

My apologies I'm not much of a coder, so hopefully I can communicate my intentions properly :).

Our project involves complex destructible environments and I'm attempting to modify the example breakable.cs to spawn a set of shapes instead of playing an animation.

In breakable.cs at line 85. I changed:

if(%obj.getDataBlock().breakAnimation !$= "") 
{
	%obj.playThread(0, %obj.getDataBlock().breakAnimation);
}

to

if(%obj.getDataBlock().breakAnimation !$= "") 
{
   new TSStatic() {
      position = %obj.position;
      rotation = %obj.rotation;
      shapeName = "art/shapes/WallSets/MMWWall34F.dts";
   };
   new PxMultiActor() {
      dataBlock = "px_woodbeam";
      position = %obj.position;
      rotation = %obj.rotation;
   };
}

this works great but of course is just for testing purposes. What I would like to do is spawn a set of shapes depending on the object destroyed either calling up several datablocks or accessing a function. I've made several attempts at doing this but I unfortunately don't have the expertise and our programmer is on vacation for the next 2 weeks. If anyone has any tips or could push me in the right direction I'd be very grateful.

Thanks for any help.