Author Topic: Crazy Spring & Console Errors  (Read 855 times)

I'm trying to make a vehicle with no spring and it has low mass. (Basically like a matchbox car)
This is the block of code with the spring.
Code: [Select]
datablock WheeledVehicleSpring(RoboSpring)
{
   // Wheel suspension properties
   length = 0.05; // Suspension travel
   force = 6000; //3000; // Spring force
   damping = 800; //800; // Spring damping
   antiSwayForce = 6; //3; // Lateral anti-sway force
};

Tires:
Code: [Select]
datablock WheeledVehicleTire(RoboBigTire)
{
   // Tires act as springs and generate lateral and longitudinal
   // forces to move the vehicle. These distortion/spring forces
   // are what convert wheel angular velocity into forces that
   // act on the rigid body.
   shapeFile = "./Wheelbig.dts";

mass = 5; //10
    radius = 1;
    staticFriction = 5;
   kineticFriction = 5;
   restitution = 0.5;

   // Spring that generates lateral tire forces
   lateralForce = 18000;
   lateralDamping = 4000;
   lateralRelaxation = 0.01;

   // Spring that generates longitudinal tire forces
   longitudinalForce = 14000;
   longitudinalDamping = 2000;
   longitudinalRelaxation = 0.01;
};
datablock WheeledVehicleTire(RoboSmallTire)
{
   // Tires act as springs and generate lateral and longitudinal
   // forces to move the vehicle. These distortion/spring forces
   // are what convert wheel angular velocity into forces that
   // act on the rigid body.
   shapeFile = "./Wheelsmall.dts";

mass = 2; //10
    radius = 1;
    staticFriction = 5;
   kineticFriction = 5;
   restitution = 0.5;

   // Spring that generates lateral tire forces
   lateralForce = 18000;
   lateralDamping = 4000;
   lateralRelaxation = 0.01;

   // Spring that generates longitudinal tire forces
   longitudinalForce = 14000;
   longitudinalDamping = 2000;
   longitudinalRelaxation = 0.01;
};
I needed different wheels on some mounts so I did:
Code: [Select]
function Robovehicle::onadd(%this,%obj)
{
parent::onadd(%this,%obj);

%obj.setWheelTire(0,RoboBigtire);
%obj.setWheelTire(1,RoboBigtire);
%obj.setWheelTire(2,RoboSmalltire);

%obj.setWheelSpring(0,RoboSpring);
%obj.setWheelSpring(1,RoboSpring);
%obj.setWheelSpring(2,RoboSpring);

%obj.setWheelSteering(0,0);
%obj.setWheelSteering(1,0);
%obj.setWheelSteering(2,-1);

%obj.setWheelPowered(0,true);
    %obj.setWheelPowered(1,true);
%obj.setWheelPowered(2,true);
}
And when I spawn the vehicle, it has wheels, it bounces all over the place, and I get this console error:
Code: [Select]
setWheelTire:  datablock does not exist (or is not a tire)
setWheelSpring:  datablock does not exist (or is not a spring)
setWheelTire:  datablock does not exist (or is not a tire)
setWheelSpring:  datablock does not exist (or is not a spring)
setWheelTire:  datablock does not exist (or is not a tire)
setWheelSpring:  datablock does not exist (or is not a spring)
Can anyone help?

Why not just set the default spring and tires in the Robovehicle?
Code: [Select]
	defaultTire	= jeepTire;
defaultSpring = jeepSpring;

Why not just set the default spring and tires in the Robovehicle?
Code: [Select]
	defaultTire	= jeepTire;
defaultSpring = jeepSpring;
Cause some are big and small?

Why not just set the default spring and tires in the Robovehicle?
Code: [Select]
	defaultTire	= jeepTire;
defaultSpring = jeepSpring;
Cause some are big and small?
Hes right, I have 2 different types of wheels so I can't use the jeep's and the jeep's tires are too big for it. Does anyone know how to make it have no suspension?

Hes right, I have 2 different types of wheels so I can't use the jeep's and the jeep's tires are too big for it. Does anyone know how to make it have no suspension?
/facepalm
anyway I think I found your problem =\
Im guessing
Code: [Select]
%obj.setWheelTire(0,RoboBigtire);
should be
Code: [Select]
%obj.setWheelTire(RoboBigtire,0);

Pandan's bike has no spring.

Pandan's bike has no spring.
That's because its a bot.
/facepalm
anyway I think I found your problem =\
Im guessing
Code: [Select]
%obj.setWheelTire(0,RoboBigtire);
should be
Code: [Select]
%obj.setWheelTire(RoboBigtire,0);
Ok I'll try that.

EDIT: I fliped them around to this:
Code: [Select]
function Robovehicle::onadd(%this,%obj)
{
parent::onadd(%this,%obj);

%obj.setWheelTire(RoboBigtire,0); //0,RoboBigtire
%obj.setWheelTire(RoboBigtire,1);
%obj.setWheelTire(RoboSmalltire,2);

%obj.setWheelSpring(RoboSpring,0); //0, RoboSpring
%obj.setWheelSpring(RoboSpring,1); //1, RoboSpring
%obj.setWheelSpring(RoboSpring,2); //2, RoboSpring

%obj.setWheelSteering(0,0);
%obj.setWheelSteering(1,0);
%obj.setWheelSteering(2,-1);

%obj.setWheelPowered(0,true);
    %obj.setWheelPowered(1,true);
%obj.setWheelPowered(2,true);
}
And when I spawn it has no wheels and doesnt jump all over the place and I get this in the console:
Code: [Select]
setWheelTire:  datablock does not exist (or is not a tire)
setWheelSpring:  datablock does not exist (or is not a spring)
setWheelTire:  datablock does not exist (or is not a tire)
setWheelSpring:  datablock does not exist (or is not a spring)
setWheelTire:  datablock does not exist (or is not a tire)
setWheelSpring:  datablock does not exist (or is not a spring)
setWheelTire: 0 datablock does not exist (or is not a tire)
setWheelTire: 1 datablock does not exist (or is not a tire)
setWheelTire: 2 datablock does not exist (or is not a tire)
setWheelSpring: 0 datablock does not exist (or is not a spring)
setWheelSpring: 1 datablock does not exist (or is not a spring)
« Last Edit: December 31, 2009, 09:43:18 AM by Crysist »

OK your first code was right, it just doesnt like your tires and springs =\

OK your first code was right, it just doesnt like your tires and springs =\
Ok I switched back to the old version, Isn't there some way to fix it? Are they case sensitive? Did i spell something wrong?
« Last Edit: December 31, 2009, 01:33:09 PM by Crysist »

You can try setting the spring to its lowest values so that it seems like there is no spring...

You can try setting the spring to its lowest values so that it seems like there is no spring...
I'm first trying to get rid of the console errors, for now I'll just make it a bot.