Game Development Community

ODE add "Ragdoll" Crash

by Luke Lapresi · in Torque Game Engine · 07/23/2009 (2:30 pm) · 1 replies

I've been using ChunckyKs's ODE implementation and have been experimenting with using the CreateHumanoid function on the death of the player. However, every time I look at the ragdoll created at a somewhat close distance, the whole engine crashes. Here is the code of the onDeath function I am using.

function GameConnection::onDeath(%this, %sourceObject, %sourceClient, %damageType, %damLoc)
{
   // Get player object transform
   %transform = %this.player.getTransform();

   // Get transform returns 7? digits seperated by a space
   // The first 3 numbers of this variable represent
   //   the position of the object
   %posX = getWord(%transform, 0);
   %posY = getWord(%transform, 1);
   %posZ = getWord(%transform, 2);

   CreateHumanoid(%posX, %posY, %posZ + 200, 1, 0.1, false, false);
   
   // Clear out the name on the corpse
   %this.player.setShapeName("");

   // Switch the client over to the death cam and unhook the player object.
   if (isObject(%this.camera) && isObject(%this.player)) {
      %this.camera.setMode("Corpse",%this.player);
      %this.setControlObject(%this.camera);
   }
   %this.player = 0;

   // Doll out points and display an appropriate message
   if (%damageType $= "Suicide" || %sourceClient == %this) {
      %this.incScore(-1);
      messageAll('MsgClientKilled','%1 takes his own life!',%this.name);
   }
   else {
      %sourceClient.incScore(1);
      messageAll('MsgClientKilled','%1 gets nailed by %2!',%this.name,%sourceClient.name);
      if (%sourceClient.score >= $Game::EndGameScore)
         cycleGame();
   }
}

Can anyone help me as to why the engine crashes whenever this happens.

About the author

Recent Threads


#1
07/24/2009 (1:41 pm)
Problem solved, changed the CreateHumanoid function to a commandToServer of the same function, and then put the commandToServer in the Armor::onDisabled callback.