This has been missing for the entire "refactor" - and is really annoying (to me at least. Should be to others too).
To reproduce, just drive any car on any track. All cars currently steer to 45°, which is both useless and unrealistic.
Patch to fix is very small. I've tried to keep this to the current coding style (header seem to have a lot of implementation code in them - what's with that? It could be driving up compilation times, btw):
Code:
Index: include/cardynamics.h
===================================================================
--- include/cardynamics.h (revision 2505)
+++ include/cardynamics.h (working copy)
@@ -196,7 +196,8 @@
std::vector <CARBRAKE <T> > brake;
std::vector <CARTIRE <T> > tire;
std::vector <CARAERO <T> > aerodynamics;
-
+ T maxangle;
+
//set at load time
std::list <std::pair <T, MATHVECTOR <T> > > mass_only_particles;
enum
@@ -1416,9 +1417,6 @@
///set the steering angle to "value", where 1.0 is maximum right lock and -1.0 is maximum left lock.
void SetSteering(const T value)
{
- //TODO: load in max steering angle
- T maxangle = 45.0;
-
T steerangle = value * maxangle; //steering angle in degrees
//ackermann stuff
@@ -1448,13 +1446,18 @@
wheel[FRONT_RIGHT].SetSteerAngle(right_wheel_angle);
}
- //TODO: load in max steering angle
///Get the maximum steering angle in degrees
T GetMaxSteeringAngle() const
{
- return 45.0;
+ return maxangle;
}
+ ///Set the mavimum steering angle in degrees
+ void SetMaxSteeringAngle(const T value){
+ maxangle = value;
+ }
+
+
///get the worldspace engine position
MATHVECTOR <T> GetEnginePosition()
{
Index: src/car.cpp
===================================================================
--- src/car.cpp (revision 2505)
+++ src/car.cpp (working copy)
@@ -1068,6 +1068,15 @@
}
}
+ //load the max steering angle
+ {
+ float maxangle = 45.0;
+ if (!GetConfigfileParam(error_output, c, "steering.max-angle", maxangle))
+ return false;
+
+ dynamics.SetMaxSteeringAngle(maxangle);
+ }
+
//load the driver
{
float mass;
Compiled and Tested on Ubuntu Karmic with gcc 4.4.0 - The bits I've added should compile on any C++ compiler ever made though
Cheers,
fudje