Author Topic: Spawning Shape in Wrong Position?  (Read 1265 times)

Quote
function spawnKHHoverData(%obj,%pos,%start)
{
   %client = %obj.client;
   if(isObject(%client.hd))
      %loc = %client.hd.getPosition();
   %xyPosA = getWords(%pos,0,1);
   %xyPosB = getWords(%loc,0,1);
   if(%xyPosA $= %xyPosB)
      return;

   //default Shape
   %off = -0.11;
   %sPos = vectorAdd(%pos,"0 0" SPC %off);
   %shape = new StaticShape()
   {
      datablock = ClimbEmptyData;
      position = %sPos;
      client = %client;
      scale = "0.2 0.2 0.1";
   };missionCleanup.add(%shape);
   KHHoverDataDelete(%obj.client);
   %client.hd = %shape;
   %loc = %shape.getPosition();
   %hack = %obj.getHackPosition();
//   echo("pos =" SPC %pos SPC "  loc =" SPC %loc SPC "  hack =" SPC %hack);
   if(getWord(%loc,2) > getWord(%pos,2))
      echo("forgeted spawn up hover");
}
%pos is defined as %obj.getPosition();

The issue is sometimes this happens. First is what's supposed to happen, next is the issue. It's spawning the shape inside the player instead of below it.
« Last Edit: July 08, 2014, 07:50:38 AM by tommybricksetti »

Just try subtracting some from the z position? I don't think hack position grabs from the feet of the player, but rather from their center point.

It spawns below %pos not %hack. Position = %sPos;

Has the %off always been there? If it's not using %hack then just subtract more from the zed on the sPos