Re: Patch for wheel spin velocity traction

David Savinkoff <[email protected]> Sun, 5 Apr 2015 18:10:25 -0600 (MDT)
Newsgroups gmane.games.torcs.general
Message-ID <1092031652.20942442.1428279025095.JavaMail.zimbra@mailid.telus.net>
Hi All,

This patch is a new standalone experiment, similar to the previous.

------------------------------------------------------------------------------
BPM Camp - Free Virtual Workshop May 6th at 10am PDT/1PM EDT
Develop your own process in accordance with the BPMN 2 standard
Learn Process modeling best practices with Bonita BPM through live exercises
http://www.bonitasoft.com/be-part-of-it/events/bpm-camp-virtual- event?utm_
source=Sourceforge_BPM_Camp_5_6_15&utm_medium=email&utm_campaign=VA_SF

_______________________________________________
Torcs-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/torcs-users
traction2.diff (text/x-patch, 873 B)
--- torcs-1.3.6/src/modules/simu/simuv2/wheel.cpp	2013-08-29 06:01:32.000000000 -0700
+++ torcs-1.3.6/src/modules/simu/simuv2/wheel.cpp	2015-04-05 14:11:15.901366913 -0700
@@ -229,11 +229,8 @@
 	wrl = wheel->spinVel * wheel->radius;
 	if ((wheel->state & SIM_WH_ONAIR) != 0) {
 		sx = sy = 0.0f;
-	} else if (v < 0.000001f) {
-		sx = wrl;
-		sy = 0.0f;
 	} else {
-		sx = (vt - wrl) / fabs(vt);
+		sx = (vt - wrl) / (0.000001 + MAX(fabs(vt) , fabs(wrl)) );
 		sy = sin(sa);
 	}
 
@@ -264,11 +261,9 @@
 	wheel->rollRes = zforce * wheel->trkPos.seg->surface->kRollRes;
     car->carElt->priv.wheel[index].rollRes = wheel->rollRes;
 
-	if (s > 0.000001f) {
 		// wheel axis based
-		Ft -= F * sx / s;
-		Fn -= F * sy / s;
-	}
+	Ft -= F * sx / (s + 0.000001f);
+	Fn -= F * sy / (s + 0.000001f);
 
 	RELAXATION2(Fn, wheel->preFn, 50.0f);
 	RELAXATION2(Ft, wheel->preFt, 50.0f);