I am having a lot of trouble getting my object to move. I have tried %obj.shape.transform(%pos); and even deleting it and creating a new one. For some reason, however, it only moves once and then stays there. I don't understand because I've tried static shapes and vehicles both. Help would be much appreciated.
//ClimbTool
datablock StaticShapeData(ClimbToolData)
{
category = "Static Shapes";
shapeFile = "./cube_col.dts";
};
datablock StaticShapeData(ClimbBrickData)
{
shapeFile = "base/data/shapes/bricks/2x2fround.dts";
};
datablock WheeledVehicleData(ClimbVehicle)
{
category = "Vehicles";
shapeFile = "base/data/shapes/bricks/2x2fround.dts";
emap = true;
maxDamage = 1000.0;
destroyedLevel = 1000.0;
mass = 0; //3100 lbs
density = 0.5;
massCenter = "0.0 0.0 0.5"; // Center of mass for rigid body
massBox = "1.5 1.5 1.5"; // Size of box used for moment of inertia,
// if zero it defaults to object bounding box
drag = 0.8; // Drag coefficient
bodyFriction = 0.21;
bodyRestitution = 0.2;
minImpactSpeed = 3; // Impacts over this invoke the script callback
softImpactSpeed = 3; // Play SoftImpact Sound
hardImpactSpeed = 10; // Play HardImpact Sound
integration = 10; // Physics integration: TickSec/Rate
collisionTol = 0.1; // Collision distance tolerance
contactTol = 0.01; // Contact velocity tolerance
engineTorque = 00; // Engine power
engineBrake = 00; // Braking when throttle is 0
brakeTorque = 00; // When brakes are applied
maxWheelSpeed = 00; // Engine scale by current speed / max speed
forwardThrust = 00;
reverseThrust = 00;
lift = 0;
maxForwardVel = 00;
maxReverseVel = 00;
horizontalSurfaceForce = 0; // Horizontal center "wing" (provides "bite" into the wind for climbing/diving and turning)
verticalSurfaceForce = 0;
rollForce = 00;
yawForce = 00;
pitchForce = 00;
rotationalDrag = 0;
stallSpeed = 0;
};
//Shape
function Player::SpawnAShape(%obj)
{
if(%obj.isHanging)
{
%pos = vectorAdd(%obj.getPosition(),"0 0 0.1");
}
else if(!%obj.isAnim && %obj.isClimbing)
{
%pos = vectorAdd(%obj.getPosition(),"0 0 -1");
}
%obj.ShapeDelete();
%nPos = vectorAdd(%pos,"0 0 -0.3");
%obj.shape = new WheeledVehicle()
{
datablock = ClimbVehicle;
// position = vectorAdd(%pos,"0 0 -0.35");
client = %obj.client;
// scale = "0.5 0.5 0.1";
};
%obj.shape.setTransform(%nPos);
%obj.isShaping=1;
}
function Player::moveShape(%obj)
{
// talk("moveShape called");
if(%obj.isShaping)
{
%pos = vectorAdd(%obj.getPosition(),"0 0 0.1");
%nPos = vectorAdd(%pos,"0 0 -0.3");
%sPos = %obj.shape.getPosition();
%obj.shape.setTransform(%nPos);
// echo(%sPos);
// talk(%sPos);
// echo(%pos);
// talk(%pos);
}
}
function Player::ShapeDelete(%obj)
{
if(%obj.isShaping)
{
// talk("ClimbTool deleted");
%obj.isShapinging=0;
%obj.shape.delete();
}
}