home *** CD-ROM | disk | FTP | other *** search
Unknown | 2004-05-10 | 29.7 KB |
view JSON data
|
view as text
|
open on a Mac
|
open on a PC
This file was not able to be converted.
This format is not currently supported by dexvert.
Confidence | Program | Detection | Match Type | Support
|
---|
100%
| file
| data
| default
|
|
hex view+--------+-------------------------+-------------------------+--------+--------+
|00000000| 00 00 00 00 00 00 00 00 | 4a db 03 2f 2f 20 42 61 |........|J..// Ba|
|00000010| 73 65 20 63 6c 61 73 73 | 20 66 6f 72 20 34 2d 77 |se class| for 4-w|
|00000020| 68 65 65 6c 65 64 20 76 | 65 68 69 63 6c 65 73 20 |heeled v|ehicles |
|00000030| 75 73 69 6e 67 20 4b 61 | 72 6d 61 0d 0a 2f 2f 20 |using Ka|rma..// |
|00000040| 41 73 73 75 6d 65 73 20 | 6e 65 67 61 74 69 76 65 |Assumes |negative|
|00000050| 2d 58 20 69 73 20 66 6f | 72 77 61 72 64 2c 20 6e |-X is fo|rward, n|
|00000060| 65 67 61 74 69 76 65 2d | 59 20 69 73 20 72 69 67 |egative-|Y is rig|
|00000070| 68 74 0d 0a 63 6c 61 73 | 73 20 4b 43 61 72 20 65 |ht..clas|s KCar e|
|00000080| 78 74 65 6e 64 73 20 4b | 56 65 68 69 63 6c 65 0d |xtends K|Vehicle.|
|00000090| 0a 20 20 20 20 61 62 73 | 74 72 61 63 74 3b 0d 0a |. abs|tract;..|
|000000a0| 0d 0a 76 61 72 20 4b 54 | 69 72 65 20 66 72 6f 6e |..var KT|ire fron|
|000000b0| 74 4c 65 66 74 2c 20 66 | 72 6f 6e 74 52 69 67 68 |tLeft, f|rontRigh|
|000000c0| 74 2c 20 72 65 61 72 4c | 65 66 74 2c 20 72 65 61 |t, rearL|eft, rea|
|000000d0| 72 52 69 67 68 74 3b 0d | 0a 76 61 72 20 28 4b 43 |rRight;.|.var (KC|
|000000e0| 61 72 29 20 63 6c 61 73 | 73 3c 4b 54 69 72 65 3e |ar) clas|s<KTire>|
|000000f0| 20 46 72 6f 6e 74 54 69 | 72 65 43 6c 61 73 73 3b | FrontTi|reClass;|
|00000100| 0d 0a 76 61 72 20 28 4b | 43 61 72 29 20 63 6c 61 |..var (K|Car) cla|
|00000110| 73 73 3c 4b 54 69 72 65 | 3e 20 52 65 61 72 54 69 |ss<KTire|> RearTi|
|00000120| 72 65 43 6c 61 73 73 3b | 0d 0a 0d 0a 2f 2f 20 57 |reClass;|....// W|
|00000130| 68 65 65 6c 20 70 6f 73 | 69 74 69 6f 6e 73 0d 0a |heel pos|itions..|
|00000140| 76 61 72 20 63 6f 6e 73 | 74 20 66 6c 6f 61 74 20 |var cons|t float |
|00000150| 57 68 65 65 6c 46 72 6f | 6e 74 41 6c 6f 6e 67 3b |WheelFro|ntAlong;|
|00000160| 0d 0a 76 61 72 20 63 6f | 6e 73 74 20 66 6c 6f 61 |..var co|nst floa|
|00000170| 74 20 57 68 65 65 6c 46 | 72 6f 6e 74 41 63 72 6f |t WheelF|rontAcro|
|00000180| 73 73 3b 0d 0a 76 61 72 | 20 63 6f 6e 73 74 20 66 |ss;..var| const f|
|00000190| 6c 6f 61 74 20 57 68 65 | 65 6c 52 65 61 72 41 6c |loat Whe|elRearAl|
|000001a0| 6f 6e 67 3b 0d 0a 76 61 | 72 20 63 6f 6e 73 74 20 |ong;..va|r const |
|000001b0| 66 6c 6f 61 74 20 57 68 | 65 65 6c 52 65 61 72 41 |float Wh|eelRearA|
|000001c0| 63 72 6f 73 73 3b 0d 0a | 76 61 72 20 63 6f 6e 73 |cross;..|var cons|
|000001d0| 74 20 66 6c 6f 61 74 20 | 57 68 65 65 6c 56 65 72 |t float |WheelVer|
|000001e0| 74 3b 0d 0a 0d 0a 76 61 | 72 20 28 4b 43 61 72 29 |t;....va|r (KCar)|
|000001f0| 20 66 6c 6f 61 74 20 20 | 20 20 20 20 20 4d 61 78 | float | Max|
|00000200| 53 74 65 65 72 41 6e 67 | 6c 65 3b 20 20 20 2f 2f |SteerAng|le; //|
|00000210| 20 28 36 35 35 33 35 20 | 3d 20 33 36 30 20 64 65 | (65535 |= 360 de|
|00000220| 67 29 0d 0a 76 61 72 20 | 28 4b 43 61 72 29 20 66 |g)..var |(KCar) f|
|00000230| 6c 6f 61 74 20 20 20 20 | 20 20 20 4d 61 78 42 72 |loat | MaxBr|
|00000240| 61 6b 65 54 6f 72 71 75 | 65 3b 20 20 2f 2f 20 42 |akeTorqu|e; // B|
|00000250| 72 61 6b 69 6e 67 20 74 | 6f 72 71 75 65 20 61 70 |raking t|orque ap|
|00000260| 70 6c 69 65 64 20 74 6f | 20 61 6c 6c 20 66 6f 75 |plied to| all fou|
|00000270| 72 20 77 68 65 65 6c 73 | 2e 20 50 6f 73 69 74 69 |r wheels|. Positi|
|00000280| 76 65 20 6f 6e 6c 79 2e | 0d 0a 76 61 72 20 28 4b |ve only.|..var (K|
|00000290| 43 61 72 29 20 66 6c 6f | 61 74 20 20 20 20 20 20 |Car) flo|at |
|000002a0| 20 54 6f 72 71 75 65 53 | 70 6c 69 74 3b 20 20 20 | TorqueS|plit; |
|000002b0| 20 20 2f 2f 20 66 72 6f | 6e 74 2f 72 65 61 72 20 | // fro|nt/rear |
|000002c0| 64 72 69 76 65 20 74 6f | 72 71 75 65 20 73 70 6c |drive to|rque spl|
|000002d0| 69 74 2e 20 31 20 69 73 | 20 66 75 6c 6c 79 20 52 |it. 1 is| fully R|
|000002e0| 57 44 2c 20 30 20 69 73 | 20 66 75 6c 6c 79 20 46 |WD, 0 is| fully F|
|000002f0| 57 44 2e 20 30 2e 35 20 | 69 73 20 73 74 61 6e 64 |WD. 0.5 |is stand|
|00000300| 61 72 64 20 34 57 44 2e | 0d 0a 0d 0a 0d 0a 2f 2f |ard 4WD.|......//|
|00000310| 20 4b 43 61 72 57 68 65 | 65 6c 4a 6f 69 6e 74 20 | KCarWhe|elJoint |
|00000320| 73 65 74 74 69 6e 67 20 | 66 6f 72 20 73 74 65 65 |setting |for stee|
|00000330| 72 69 6e 67 20 28 73 65 | 65 20 4b 43 61 72 57 68 |ring (se|e KCarWh|
|00000340| 65 65 6c 4a 6f 69 6e 74 | 29 2e 20 44 75 70 6c 69 |eelJoint|). Dupli|
|00000350| 63 61 74 65 64 20 68 65 | 72 65 20 66 6f 72 20 68 |cated he|re for h|
|00000360| 61 6e 64 69 6e 65 73 73 | 2e 0d 0a 76 61 72 20 28 |andiness|...var (|
|00000370| 4b 43 61 72 29 20 66 6c | 6f 61 74 20 20 20 20 20 |KCar) fl|oat |
|00000380| 20 20 53 74 65 65 72 50 | 72 6f 70 47 61 70 3b 0d | SteerP|ropGap;.|
|00000390| 0a 76 61 72 20 28 4b 43 | 61 72 29 20 66 6c 6f 61 |.var (KC|ar) floa|
|000003a0| 74 20 20 20 20 20 20 20 | 53 74 65 65 72 54 6f 72 |t |SteerTor|
|000003b0| 71 75 65 3b 0d 0a 76 61 | 72 20 28 4b 43 61 72 29 |que;..va|r (KCar)|
|000003c0| 20 66 6c 6f 61 74 20 20 | 20 20 20 20 20 53 74 65 | float | Ste|
|000003d0| 65 72 53 70 65 65 64 3b | 0d 0a 0d 0a 2f 2f 20 4b |erSpeed;|....// K|
|000003e0| 43 61 72 57 68 65 65 6c | 53 75 73 70 65 6e 73 69 |CarWheel|Suspensi|
|000003f0| 6f 6e 20 73 65 74 74 69 | 6e 67 0d 0a 76 61 72 20 |on setti|ng..var |
|00000400| 28 4b 43 61 72 29 20 66 | 6c 6f 61 74 20 20 20 20 |(KCar) f|loat |
|00000410| 20 20 20 53 75 73 70 53 | 74 69 66 66 6e 65 73 73 | SuspS|tiffness|
|00000420| 3b 0d 0a 76 61 72 20 28 | 4b 43 61 72 29 20 66 6c |;..var (|KCar) fl|
|00000430| 6f 61 74 20 20 20 20 20 | 20 20 53 75 73 70 44 61 |oat | SuspDa|
|00000440| 6d 70 69 6e 67 3b 0d 0a | 76 61 72 20 28 4b 43 61 |mping;..|var (KCa|
|00000450| 72 29 20 66 6c 6f 61 74 | 20 20 20 20 20 20 20 53 |r) float| S|
|00000460| 75 73 70 48 69 67 68 4c | 69 6d 69 74 3b 0d 0a 76 |uspHighL|imit;..v|
|00000470| 61 72 20 28 4b 43 61 72 | 29 20 66 6c 6f 61 74 20 |ar (KCar|) float |
|00000480| 20 20 20 20 20 20 53 75 | 73 70 4c 6f 77 4c 69 6d | Su|spLowLim|
|00000490| 69 74 3b 0d 0a 76 61 72 | 20 28 4b 43 61 72 29 20 |it;..var| (KCar) |
|000004a0| 66 6c 6f 61 74 20 20 20 | 20 20 20 20 53 75 73 70 |float | Susp|
|000004b0| 52 65 66 3b 0d 0a 0d 0a | 2f 2f 20 4b 54 69 72 65 |Ref;....|// KTire|
|000004c0| 20 73 65 74 74 69 6e 67 | 73 2e 20 44 75 70 6c 69 | setting|s. Dupli|
|000004d0| 63 61 74 65 64 20 68 65 | 72 65 20 66 6f 72 20 68 |cated he|re for h|
|000004e0| 61 6e 64 79 20 74 75 6e | 69 6e 67 2e 0d 0a 76 61 |andy tun|ing...va|
|000004f0| 72 20 28 4b 43 61 72 29 | 20 66 6c 6f 61 74 20 20 |r (KCar)| float |
|00000500| 20 20 20 20 20 54 69 72 | 65 52 6f 6c 6c 46 72 69 | Tir|eRollFri|
|00000510| 63 74 69 6f 6e 3b 0d 0a | 76 61 72 20 28 4b 43 61 |ction;..|var (KCa|
|00000520| 72 29 20 66 6c 6f 61 74 | 20 20 20 20 20 20 20 54 |r) float| T|
|00000530| 69 72 65 4c 61 74 65 72 | 61 6c 46 72 69 63 74 69 |ireLater|alFricti|
|00000540| 6f 6e 3b 0d 0a 76 61 72 | 20 28 4b 43 61 72 29 20 |on;..var| (KCar) |
|00000550| 66 6c 6f 61 74 20 20 20 | 20 20 20 20 54 69 72 65 |float | Tire|
|00000560| 52 6f 6c 6c 53 6c 69 70 | 3b 0d 0a 76 61 72 20 28 |RollSlip|;..var (|
|00000570| 4b 43 61 72 29 20 66 6c | 6f 61 74 20 20 20 20 20 |KCar) fl|oat |
|00000580| 20 20 54 69 72 65 4c 61 | 74 65 72 61 6c 53 6c 69 | TireLa|teralSli|
|00000590| 70 3b 0d 0a 76 61 72 20 | 28 4b 43 61 72 29 20 66 |p;..var |(KCar) f|
|000005a0| 6c 6f 61 74 20 20 20 20 | 20 20 20 54 69 72 65 4d |loat | TireM|
|000005b0| 69 6e 53 6c 69 70 3b 0d | 0a 76 61 72 20 28 4b 43 |inSlip;.|.var (KC|
|000005c0| 61 72 29 20 66 6c 6f 61 | 74 20 20 20 20 20 20 20 |ar) floa|t |
|000005d0| 54 69 72 65 53 6c 69 70 | 52 61 74 65 3b 0d 0a 76 |TireSlip|Rate;..v|
|000005e0| 61 72 20 28 4b 43 61 72 | 29 20 66 6c 6f 61 74 20 |ar (KCar|) float |
|000005f0| 20 20 20 20 20 20 54 69 | 72 65 53 6f 66 74 6e 65 | Ti|reSoftne|
|00000600| 73 73 3b 0d 0a 76 61 72 | 20 28 4b 43 61 72 29 20 |ss;..var| (KCar) |
|00000610| 66 6c 6f 61 74 20 20 20 | 20 20 20 20 54 69 72 65 |float | Tire|
|00000620| 41 64 68 65 73 69 6f 6e | 3b 0d 0a 76 61 72 20 28 |Adhesion|;..var (|
|00000630| 4b 43 61 72 29 20 66 6c | 6f 61 74 20 20 20 20 20 |KCar) fl|oat |
|00000640| 20 20 54 69 72 65 52 65 | 73 74 69 74 75 74 69 6f | TireRe|stitutio|
|00000650| 6e 3b 0d 0a 76 61 72 20 | 28 4b 43 61 72 29 20 66 |n;..var |(KCar) f|
|00000660| 6c 6f 61 74 20 20 20 20 | 20 20 20 54 69 72 65 4d |loat | TireM|
|00000670| 61 73 73 3b 0d 0a 0d 0a | 76 61 72 20 28 4b 43 61 |ass;....|var (KCa|
|00000680| 72 29 20 66 6c 6f 61 74 | 09 20 20 20 48 61 6e 64 |r) float|. Hand|
|00000690| 62 72 61 6b 65 54 68 72 | 65 73 68 3b 20 2f 2f 20 |brakeThr|esh; // |
|000006a0| 73 70 65 65 64 20 61 62 | 6f 76 65 20 77 68 69 63 |speed ab|ove whic|
|000006b0| 68 20 68 61 6e 64 62 72 | 61 6b 65 20 63 6f 6d 65 |h handbr|ake come|
|000006c0| 73 20 6f 6e 20 3d 5d 0d | 0a 76 61 72 20 28 4b 43 |s on =].|.var (KC|
|000006d0| 61 72 29 20 66 6c 6f 61 | 74 09 20 20 20 54 69 72 |ar) floa|t. Tir|
|000006e0| 65 48 61 6e 64 62 72 61 | 6b 65 53 6c 69 70 3b 20 |eHandbra|keSlip; |
|000006f0| 2f 2f 20 41 64 64 69 74 | 69 6f 6e 61 6c 20 6c 61 |// Addit|ional la|
|00000700| 74 65 72 61 6c 20 73 6c | 69 70 20 77 68 65 6e 20 |teral sl|ip when |
|00000710| 68 61 6e 64 62 72 61 6b | 65 20 65 6e 67 61 67 65 |handbrak|e engage|
|00000720| 64 0d 0a 76 61 72 20 28 | 4b 43 61 72 29 20 66 6c |d..var (|KCar) fl|
|00000730| 6f 61 74 09 20 20 20 54 | 69 72 65 48 61 6e 64 62 |oat. T|ireHandb|
|00000740| 72 61 6b 65 46 72 69 63 | 74 69 6f 6e 3b 20 2f 2f |rakeFric|tion; //|
|00000750| 20 41 64 64 69 74 69 6f | 6e 61 6c 20 6c 61 74 65 | Additio|nal late|
|00000760| 72 61 6c 20 66 72 69 63 | 74 69 6f 6e 20 77 68 65 |ral fric|tion whe|
|00000770| 6e 20 68 61 6e 64 62 72 | 61 6b 65 20 65 6e 67 61 |n handbr|ake enga|
|00000780| 67 65 64 0d 0a 0d 0a 76 | 61 72 20 28 4b 43 61 72 |ged....v|ar (KCar|
|00000790| 29 20 66 6c 6f 61 74 20 | 20 20 20 20 20 20 43 68 |) float | Ch|
|000007a0| 61 73 73 69 73 4d 61 73 | 73 3b 0d 0a 0d 0a 76 61 |assisMas|s;....va|
|000007b0| 72 20 28 4b 43 61 72 29 | 20 66 6c 6f 61 74 09 20 |r (KCar)| float. |
|000007c0| 20 20 53 74 6f 70 54 68 | 72 65 73 68 6f 6c 64 3b | StopTh|reshold;|
|000007d0| 20 2f 2f 20 46 6f 72 77 | 61 72 64 20 76 65 6c 6f | // Forw|ard velo|
|000007e0| 63 69 74 79 20 75 6e 64 | 65 72 20 77 68 69 63 68 |city und|er which|
|000007f0| 20 62 72 61 6b 65 73 20 | 62 65 63 6f 6d 65 20 64 | brakes |become d|
|00000800| 72 69 76 65 2e 0d 0a 0d | 0a 76 61 72 20 28 4b 43 |rive....|.var (KC|
|00000810| 61 72 29 20 49 6e 74 65 | 72 70 43 75 72 76 65 09 |ar) Inte|rpCurve.|
|00000820| 54 6f 72 71 75 65 43 75 | 72 76 65 3b 20 2f 2f 20 |TorqueCu|rve; // |
|00000830| 45 6e 67 69 6e 65 20 52 | 50 4d 20 69 6e 2c 20 54 |Engine R|PM in, T|
|00000840| 6f 72 71 75 65 20 6f 75 | 74 2e 0d 0a 0d 0a 76 61 |orque ou|t.....va|
|00000850| 72 20 28 4b 43 61 72 29 | 20 66 6c 6f 61 74 09 09 |r (KCar)| float..|
|00000860| 46 6c 69 70 54 6f 72 71 | 75 65 3b 0d 0a 76 61 72 |FlipTorq|ue;..var|
|00000870| 20 28 4b 43 61 72 29 20 | 66 6c 6f 61 74 09 09 46 | (KCar) |float..F|
|00000880| 6c 69 70 54 69 6d 65 3b | 0d 0a 0d 0a 76 61 72 20 |lipTime;|....var |
|00000890| 28 4b 43 61 72 29 20 66 | 6c 6f 61 74 09 09 4d 61 |(KCar) f|loat..Ma|
|000008a0| 78 4e 65 74 55 70 64 61 | 74 65 49 6e 74 65 72 76 |xNetUpda|teInterv|
|000008b0| 61 6c 3b 0d 0a 0d 0a 76 | 61 72 20 69 6e 74 20 20 |al;....v|ar int |
|000008c0| 20 20 20 20 47 65 61 72 | 3b 20 20 2f 2f 20 31 20 | Gear|; // 1 |
|000008d0| 69 73 20 66 6f 72 77 61 | 72 64 2c 20 2d 31 20 69 |is forwa|rd, -1 i|
|000008e0| 73 20 62 61 63 6b 77 61 | 72 64 2e 20 43 75 72 72 |s backwa|rd. Curr|
|000008f0| 65 6e 74 6c 79 20 73 79 | 6d 6d 65 74 72 69 63 20 |ently sy|mmetric |
|00000900| 70 6f 77 65 72 2f 74 6f | 72 71 75 65 20 63 75 72 |power/to|rque cur|
|00000910| 76 65 0d 0a 0d 0a 2f 2f | 20 43 61 72 20 6f 75 74 |ve....//| Car out|
|00000920| 70 75 74 0d 0a 76 61 72 | 20 66 6c 6f 61 74 20 20 |put..var| float |
|00000930| 20 20 20 20 20 20 20 20 | 20 20 20 20 57 68 65 65 | | Whee|
|00000940| 6c 53 70 69 6e 53 70 65 | 65 64 3b 20 20 2f 2f 20 |lSpinSpe|ed; // |
|00000950| 43 75 72 72 65 6e 74 20 | 28 61 76 65 72 61 67 65 |Current |(average|
|00000960| 64 29 20 52 50 4d 20 6f | 66 20 72 65 61 72 20 77 |d) RPM o|f rear w|
|00000970| 68 65 65 6c 73 0d 0a 76 | 61 72 20 66 6c 6f 61 74 |heels..v|ar float|
|00000980| 09 09 09 20 20 20 46 6f | 72 77 61 72 64 56 65 6c |... Fo|rwardVel|
|00000990| 3b 09 09 2f 2f 20 43 6f | 6d 70 6f 6e 65 6e 74 20 |;..// Co|mponent |
|000009a0| 6f 66 20 63 61 72 73 20 | 76 65 6c 6f 63 69 74 79 |of cars |velocity|
|000009b0| 20 69 6e 20 69 74 73 20 | 66 6f 72 77 61 72 64 20 | in its |forward |
|000009c0| 64 69 72 65 63 74 69 6f | 6e 2e 0d 0a 76 61 72 20 |directio|n...var |
|000009d0| 62 6f 6f 6c 09 09 09 20 | 20 20 62 49 73 49 6e 76 |bool... | bIsInv|
|000009e0| 65 72 74 65 64 3b 20 20 | 20 20 20 2f 2f 20 55 70 |erted; | // Up|
|000009f0| 64 61 74 65 64 20 69 6e | 20 54 69 63 6b 20 2d 20 |dated in| Tick - |
|00000a00| 69 6e 64 69 63 61 74 65 | 73 20 69 66 20 63 61 72 |indicate|s if car|
|00000a10| 20 69 73 20 6e 6f 74 20 | 75 70 72 69 67 68 74 2e | is not |upright.|
|00000a20| 0d 0a 0d 0a 2f 2f 20 49 | 6e 74 65 72 6e 61 6c 0d |....// I|nternal.|
|00000a30| 0a 76 61 72 20 62 6f 6f | 6c 09 09 09 20 20 20 49 |.var boo|l... I|
|00000a40| 73 44 72 69 76 69 6e 67 | 3b 0d 0a 76 61 72 20 66 |sDriving|;..var f|
|00000a50| 6c 6f 61 74 09 09 09 20 | 20 20 46 6c 69 70 54 69 |loat... | FlipTi|
|00000a60| 6d 65 4c 65 66 74 3b 0d | 0a 76 61 72 20 66 6c 6f |meLeft;.|.var flo|
|00000a70| 61 74 09 09 09 20 20 20 | 4e 65 78 74 4e 65 74 55 |at... |NextNetU|
|00000a80| 70 64 61 74 65 54 69 6d | 65 3b 09 2f 2f 20 4e 65 |pdateTim|e;.// Ne|
|00000a90| 78 74 20 74 69 6d 65 20 | 77 65 20 73 68 6f 75 6c |xt time |we shoul|
|00000aa0| 64 20 66 6f 72 63 65 20 | 61 6e 20 75 70 64 61 74 |d force |an updat|
|00000ab0| 65 20 6f 66 20 76 65 68 | 69 63 6c 65 73 20 73 74 |e of veh|icles st|
|00000ac0| 61 74 65 2e 0d 0a 0d 0a | 2f 2f 20 4c 6f 77 2d 6c |ate.....|// Low-l|
|00000ad0| 65 76 65 6c 20 64 72 69 | 76 65 20 64 61 74 61 20 |evel dri|ve data |
|00000ae0| 28 74 68 69 73 20 69 73 | 20 72 65 70 6c 69 63 61 |(this is| replica|
|00000af0| 74 65 64 29 0d 0a 76 61 | 72 20 62 6f 6f 6c 09 09 |ted)..va|r bool..|
|00000b00| 09 20 20 20 4f 75 74 70 | 75 74 42 72 61 6b 65 3b |. Outp|utBrake;|
|00000b10| 0d 0a 76 61 72 20 66 6c | 6f 61 74 09 09 09 20 20 |..var fl|oat... |
|00000b20| 20 4f 75 74 70 75 74 54 | 6f 72 71 75 65 3b 0d 0a | OutputT|orque;..|
|00000b30| 76 61 72 20 62 6f 6f 6c | 09 09 09 20 20 20 4f 75 |var bool|... Ou|
|00000b40| 74 70 75 74 48 61 6e 64 | 62 72 61 6b 65 4f 6e 3b |tputHand|brakeOn;|
|00000b50| 0d 0a 0d 0a 0d 0a 2f 2f | 20 4e 65 74 77 6f 72 6b |......//| Network|
|00000b60| 69 6e 67 0d 0a 73 74 72 | 75 63 74 20 4b 43 61 72 |ing..str|uct KCar|
|00000b70| 53 74 61 74 65 0d 0a 7b | 0d 0a 09 76 61 72 20 4b |State..{|...var K|
|00000b80| 52 42 56 65 63 09 09 09 | 09 43 68 61 73 73 69 73 |RBVec...|.Chassis|
|00000b90| 50 6f 73 69 74 69 6f 6e | 3b 0d 0a 09 76 61 72 20 |Position|;...var |
|00000ba0| 51 75 61 74 09 09 09 09 | 43 68 61 73 73 69 73 51 |Quat....|ChassisQ|
|00000bb0| 75 61 74 65 72 6e 69 6f | 6e 3b 0d 0a 09 76 61 72 |uaternio|n;...var|
|00000bc0| 20 4b 52 42 56 65 63 09 | 09 09 09 43 68 61 73 73 | KRBVec.|...Chass|
|00000bd0| 69 73 4c 69 6e 56 65 6c | 3b 0d 0a 09 76 61 72 20 |isLinVel|;...var |
|00000be0| 4b 52 42 56 65 63 09 09 | 09 09 43 68 61 73 73 69 |KRBVec..|..Chassi|
|00000bf0| 73 41 6e 67 56 65 6c 3b | 0d 0a 0d 0a 09 76 61 72 |sAngVel;|.....var|
|00000c00| 20 66 6c 6f 61 74 09 09 | 09 09 57 68 65 65 6c 48 | float..|..WheelH|
|00000c10| 65 69 67 68 74 5b 34 5d | 3b 20 2f 2f 20 46 4c 2c |eight[4]|; // FL,|
|00000c20| 20 46 52 2c 20 52 4c 2c | 20 52 52 0d 0a 09 76 61 | FR, RL,| RR...va|
|00000c30| 72 20 66 6c 6f 61 74 09 | 09 09 09 46 72 6f 6e 74 |r float.|...Front|
|00000c40| 57 68 65 65 6c 41 6e 67 | 5b 32 5d 3b 20 2f 2f 20 |WheelAng|[2]; // |
|00000c50| 46 4c 2c 20 46 52 0d 0a | 0d 0a 09 76 61 72 20 66 |FL, FR..|...var f|
|00000c60| 6c 6f 61 74 09 09 09 09 | 57 68 65 65 6c 56 65 72 |loat....|WheelVer|
|00000c70| 74 56 65 6c 5b 34 5d 3b | 0d 0a 09 2f 2f 76 61 72 |tVel[4];|...//var|
|00000c80| 20 66 6c 6f 61 74 09 09 | 09 09 57 68 65 65 6c 53 | float..|..WheelS|
|00000c90| 70 69 6e 56 65 6c 5b 34 | 5d 3b 0d 0a 0d 0a 09 76 |pinVel[4|];.....v|
|00000ca0| 61 72 20 66 6c 6f 61 74 | 09 09 09 09 53 65 72 76 |ar float|....Serv|
|00000cb0| 65 72 53 74 65 65 72 69 | 6e 67 3b 0d 0a 0d 0a 09 |erSteeri|ng;.....|
|00000cc0| 76 61 72 20 66 6c 6f 61 | 74 09 09 09 09 53 65 72 |var floa|t....Ser|
|00000cd0| 76 65 72 54 6f 72 71 75 | 65 3b 0d 0a 09 76 61 72 |verTorqu|e;...var|
|00000ce0| 20 62 6f 6f 6c 09 09 09 | 09 53 65 72 76 65 72 42 | bool...|.ServerB|
|00000cf0| 72 61 6b 65 3b 0d 0a 09 | 76 61 72 20 62 6f 6f 6c |rake;...|var bool|
|00000d00| 09 09 09 20 20 20 20 53 | 65 72 76 65 72 48 61 6e |... S|erverHan|
|00000d10| 64 62 72 61 6b 65 4f 6e | 3b 0d 0a 0d 0a 09 76 61 |dbrakeOn|;.....va|
|00000d20| 72 20 62 6f 6f 6c 09 09 | 09 09 62 4e 65 77 53 74 |r bool..|..bNewSt|
|00000d30| 61 74 65 3b 20 2f 2f 20 | 53 65 74 20 74 6f 20 74 |ate; // |Set to t|
|00000d40| 72 75 65 20 77 68 65 6e | 65 76 65 72 20 61 20 6e |rue when|ever a n|
|00000d50| 65 77 20 73 74 61 74 65 | 20 69 73 20 72 65 63 65 |ew state| is rece|
|00000d60| 69 76 65 64 20 61 6e 64 | 20 73 68 6f 75 6c 64 20 |ived and| should |
|00000d70| 62 65 20 70 72 6f 63 65 | 73 73 65 64 0d 0a 7d 3b |be proce|ssed..};|
|00000d80| 0d 0a 0d 0a 76 61 72 20 | 4b 52 69 67 69 64 42 6f |....var |KRigidBo|
|00000d90| 64 79 53 74 61 74 65 09 | 09 43 68 61 73 73 69 73 |dyState.|.Chassis|
|00000da0| 53 74 61 74 65 3b 0d 0a | 0d 0a 76 61 72 20 4b 43 |State;..|..var KC|
|00000db0| 61 72 53 74 61 74 65 09 | 09 09 43 61 72 53 74 61 |arState.|..CarSta|
|00000dc0| 74 65 3b 20 2f 2f 20 54 | 68 69 73 20 69 73 20 72 |te; // T|his is r|
|00000dd0| 65 70 6c 69 63 61 74 65 | 64 20 74 6f 20 74 68 65 |eplicate|d to the|
|00000de0| 20 63 61 72 2c 20 61 6e | 64 20 70 72 6f 63 65 73 | car, an|d proces|
|00000df0| 73 65 64 20 74 6f 20 75 | 70 64 61 74 65 20 61 6c |sed to u|pdate al|
|00000e00| 6c 20 74 68 65 20 70 61 | 72 74 73 2e 0d 0a 76 61 |l the pa|rts...va|
|00000e10| 72 20 62 6f 6f 6c 09 09 | 09 09 62 4e 65 77 43 61 |r bool..|..bNewCa|
|00000e20| 72 53 74 61 74 65 3b 20 | 2f 2f 20 49 6e 64 69 63 |rState; |// Indic|
|00000e30| 61 74 65 64 20 74 68 65 | 72 65 20 69 73 20 6e 65 |ated the|re is ne|
|00000e40| 77 20 64 61 74 61 20 70 | 72 6f 63 65 73 73 65 64 |w data p|rocessed|
|00000e50| 2c 20 61 6e 64 20 63 68 | 61 73 73 69 73 20 52 42 |, and ch|assis RB|
|00000e60| 53 74 61 74 65 20 73 68 | 6f 75 6c 64 20 62 65 20 |State sh|ould be |
|00000e70| 75 70 64 61 74 65 64 2e | 0d 0a 0d 0a 72 65 70 6c |updated.|....repl|
|00000e80| 69 63 61 74 69 6f 6e 0d | 0a 7b 0d 0a 09 2f 2f 20 |ication.|.{...// |
|00000e90| 57 65 20 72 65 70 6c 69 | 63 61 74 65 20 74 68 65 |We repli|cate the|
|00000ea0| 20 47 65 61 72 20 66 6f | 72 20 62 72 61 6b 65 2d | Gear fo|r brake-|
|00000eb0| 6c 69 67 68 74 73 20 65 | 74 63 2e 0d 0a 09 75 6e |lights e|tc....un|
|00000ec0| 72 65 6c 69 61 62 6c 65 | 20 69 66 28 52 6f 6c 65 |reliable| if(Role|
|00000ed0| 20 3d 3d 20 52 4f 4c 45 | 5f 41 75 74 68 6f 72 69 | == ROLE|_Authori|
|00000ee0| 74 79 29 0d 0a 09 09 43 | 61 72 53 74 61 74 65 2c |ty)....C|arState,|
|00000ef0| 20 47 65 61 72 3b 0d 0a | 0d 0a 09 72 65 6c 69 61 | Gear;..|...relia|
|00000f00| 62 6c 65 20 69 66 28 52 | 6f 6c 65 20 3d 3d 20 52 |ble if(R|ole == R|
|00000f10| 4f 4c 45 5f 41 75 74 68 | 6f 72 69 74 79 29 0d 0a |OLE_Auth|ority)..|
|00000f20| 09 09 46 6c 69 70 54 69 | 6d 65 4c 65 66 74 3b 0d |..FlipTi|meLeft;.|
|00000f30| 0a 7d 0d 0a 0d 0a 2f 2f | 20 57 68 65 6e 20 6e 65 |.}....//| When ne|
|00000f40| 77 20 69 6e 66 6f 72 6d | 61 74 69 6f 6e 20 69 73 |w inform|ation is|
|00000f50| 20 72 65 63 65 69 76 65 | 64 2c 20 73 65 65 20 69 | receive|d, see i|
|00000f60| 66 20 69 74 73 20 6e 65 | 77 2e 20 49 66 20 73 6f |f its ne|w. If so|
|00000f70| 2c 20 70 61 73 73 20 62 | 69 74 73 20 6f 66 66 20 |, pass b|its off |
|00000f80| 74 68 65 20 74 68 65 20 | 77 68 65 65 6c 73 2e 0d |the the |wheels..|
|00000f90| 0a 2f 2f 20 45 61 63 68 | 20 70 61 72 74 20 77 69 |.// Each| part wi|
|00000fa0| 6c 6c 20 74 68 65 6e 20 | 75 70 64 61 74 65 20 69 |ll then |update i|
|00000fb0| 74 73 20 72 69 67 69 64 | 20 62 6f 64 79 20 70 6f |ts rigid| body po|
|00000fc0| 73 69 74 69 6f 6e 20 76 | 69 61 20 74 68 65 20 4b |sition v|ia the K|
|00000fd0| 55 70 64 61 74 65 53 74 | 61 74 65 20 65 76 65 6e |UpdateSt|ate even|
|00000fe0| 74 2e 0d 0a 2f 2f 20 4a | 54 4f 44 4f 3a 20 54 68 |t...// J|TODO: Th|
|00000ff0| 69 73 20 69 73 20 77 68 | 65 72 65 20 63 6c 65 76 |is is wh|ere clev|
|00001000| 65 72 20 75 6e 70 61 63 | 6b 69 6e 67 20 77 6f 75 |er unpac|king wou|
|00001010| 6c 64 20 68 61 70 70 65 | 6e 2e 0d 0a 73 69 6d 75 |ld happe|n...simu|
|00001020| 6c 61 74 65 64 20 65 76 | 65 6e 74 20 56 65 68 69 |lated ev|ent Vehi|
|00001030| 63 6c 65 53 74 61 74 65 | 52 65 63 65 69 76 65 64 |cleState|Received|
|00001040| 28 29 0d 0a 7b 0d 0a 09 | 6c 6f 63 61 6c 20 76 65 |()..{...|local ve|
|00001050| 63 74 6f 72 20 43 68 61 | 73 73 69 73 59 2c 20 53 |ctor Cha|ssisY, S|
|00001060| 74 65 65 72 59 2c 20 43 | 68 61 73 73 69 73 5a 2c |teerY, C|hassisZ,|
|00001070| 20 63 61 6c 63 50 6f 73 | 2c 20 57 68 65 65 6c 59 | calcPos|, WheelY|
|00001080| 2c 20 6c 50 6f 73 3b 0d | 0a 09 6c 6f 63 61 6c 20 |, lPos;.|..local |
|00001090| 76 65 63 74 6f 72 20 63 | 68 61 73 73 69 73 50 6f |vector c|hassisPo|
|000010a0| 73 2c 20 63 68 61 73 73 | 69 73 4c 69 6e 56 65 6c |s, chass|isLinVel|
|000010b0| 2c 20 63 68 61 73 73 69 | 73 41 6e 67 56 65 6c 2c |, chassi|sAngVel,|
|000010c0| 20 57 68 65 65 6c 4c 69 | 6e 56 65 6c 2c 20 77 50 | WheelLi|nVel, wP|
|000010d0| 6f 73 52 65 6c 3b 0d 0a | 09 6c 6f 63 61 6c 20 51 |osRel;..|.local Q|
|000010e0| 75 61 74 20 72 65 6c 51 | 2c 20 57 68 65 65 6c 51 |uat relQ|, WheelQ|
|000010f0| 3b 0d 0a 0d 0a 09 69 66 | 28 21 43 61 72 53 74 61 |;.....if|(!CarSta|
|00001100| 74 65 2e 62 4e 65 77 53 | 74 61 74 65 29 0d 0a 09 |te.bNewS|tate)...|
|00001110| 09 72 65 74 75 72 6e 3b | 0d 0a 0d 0a 09 2f 2f 20 |.return;|.....// |
|00001120| 44 6f 6e 27 74 20 64 6f | 20 61 6e 79 74 68 69 6e |Don't do| anythin|
|00001130| 67 20 69 66 20 63 61 72 | 20 69 73 6e 27 74 20 73 |g if car| isn't s|
|00001140| 74 61 72 74 65 64 20 75 | 70 2e 09 0d 0a 09 69 66 |tarted u|p.....if|
|00001150| 28 66 72 6f 6e 74 4c 65 | 66 74 20 3d 3d 20 4e 6f |(frontLe|ft == No|
|00001160| 6e 65 20 7c 7c 20 66 72 | 6f 6e 74 52 69 67 68 74 |ne || fr|ontRight|
|00001170| 20 3d 3d 20 4e 6f 6e 65 | 20 7c 7c 20 72 65 61 72 | == None| || rear|
|00001180| 4c 65 66 74 20 3d 3d 20 | 4e 6f 6e 65 20 7c 7c 20 |Left == |None || |
|00001190| 72 65 61 72 52 69 67 68 | 74 20 3d 3d 20 4e 6f 6e |rearRigh|t == Non|
|000011a0| 65 29 0d 0a 09 09 72 65 | 74 75 72 6e 3b 0d 0a 0d |e)....re|turn;...|
|000011b0| 0a 09 2f 2f 20 47 65 74 | 20 72 6f 6f 74 20 63 68 |..// Get| root ch|
|000011c0| 61 73 73 69 73 20 69 6e | 66 6f 0d 0a 09 43 68 61 |assis in|fo...Cha|
|000011d0| 73 73 69 73 53 74 61 74 | 65 2e 50 6f 73 69 74 69 |ssisStat|e.Positi|
|000011e0| 6f 6e 20 3d 20 43 61 72 | 53 74 61 74 65 2e 43 68 |on = Car|State.Ch|
|000011f0| 61 73 73 69 73 50 6f 73 | 69 74 69 6f 6e 3b 0d 0a |assisPos|ition;..|
|00001200| 09 43 68 61 73 73 69 73 | 53 74 61 74 65 2e 51 75 |.Chassis|State.Qu|
|00001210| 61 74 65 72 6e 69 6f 6e | 20 3d 20 43 61 72 53 74 |aternion| = CarSt|
|00001220| 61 74 65 2e 43 68 61 73 | 73 69 73 51 75 61 74 65 |ate.Chas|sisQuate|
|00001230| 72 6e 69 6f 6e 3b 0d 0a | 09 43 68 61 73 73 69 73 |rnion;..|.Chassis|
|00001240| 53 74 61 74 65 2e 4c 69 | 6e 56 65 6c 20 3d 20 43 |State.Li|nVel = C|
|00001250| 61 72 53 74 61 74 65 2e | 43 68 61 73 73 69 73 4c |arState.|ChassisL|
|00001260| 69 6e 56 65 6c 3b 0d 0a | 09 43 68 61 73 73 69 73 |inVel;..|.Chassis|
|00001270| 53 74 61 74 65 2e 41 6e | 67 56 65 6c 20 3d 20 43 |State.An|gVel = C|
|00001280| 61 72 53 74 61 74 65 2e | 43 68 61 73 73 69 73 41 |arState.|ChassisA|
|00001290| 6e 67 56 65 6c 3b 0d 0a | 0d 0a 09 63 68 61 73 73 |ngVel;..|...chass|
|000012a0| 69 73 50 6f 73 20 3d 20 | 4b 52 42 56 65 63 54 6f |isPos = |KRBVecTo|
|000012b0| 56 65 63 74 6f 72 28 43 | 61 72 53 74 61 74 65 2e |Vector(C|arState.|
|000012c0| 43 68 61 73 73 69 73 50 | 6f 73 69 74 69 6f 6e 29 |ChassisP|osition)|
|000012d0| 3b 0d 0a 09 63 68 61 73 | 73 69 73 4c 69 6e 56 65 |;...chas|sisLinVe|
|000012e0| 6c 20 3d 20 4b 52 42 56 | 65 63 54 6f 56 65 63 74 |l = KRBV|ecToVect|
|000012f0| 6f 72 28 43 61 72 53 74 | 61 74 65 2e 43 68 61 73 |or(CarSt|ate.Chas|
|00001300| 73 69 73 4c 69 6e 56 65 | 6c 29 3b 0d 0a 09 63 68 |sisLinVe|l);...ch|
|00001310| 61 73 73 69 73 41 6e 67 | 56 65 6c 20 3d 20 4b 52 |assisAng|Vel = KR|
|00001320| 42 56 65 63 54 6f 56 65 | 63 74 6f 72 28 43 61 72 |BVecToVe|ctor(Car|
|00001330| 53 74 61 74 65 2e 43 68 | 61 73 73 69 73 41 6e 67 |State.Ch|assisAng|
|00001340| 56 65 6c 29 3b 0d 0a 0d | 0a 09 2f 2f 20 43 61 6c |Vel);...|..// Cal|
|00001350| 63 20 63 68 61 73 73 69 | 73 20 73 74 61 74 65 20 |c chassi|s state |
|00001360| 61 78 65 73 0d 0a 09 43 | 68 61 73 73 69 73 59 20 |axes...C|hassisY |
|00001370| 3d 20 51 75 61 74 52 6f | 74 61 74 65 56 65 63 74 |= QuatRo|tateVect|
|00001380| 6f 72 28 43 61 72 53 74 | 61 74 65 2e 43 68 61 73 |or(CarSt|ate.Chas|
|00001390| 73 69 73 51 75 61 74 65 | 72 6e 69 6f 6e 2c 20 76 |sisQuate|rnion, v|
|000013a0| 65 63 74 28 30 2c 20 31 | 2c 20 30 29 29 3b 0d 0a |ect(0, 1|, 0));..|
|000013b0| 09 43 68 61 73 73 69 73 | 5a 20 3d 20 51 75 61 74 |.Chassis|Z = Quat|
|000013c0| 52 6f 74 61 74 65 56 65 | 63 74 6f 72 28 43 61 72 |RotateVe|ctor(Car|
|000013d0| 53 74 61 74 65 2e 43 68 | 61 73 73 69 73 51 75 61 |State.Ch|assisQua|
|000013e0| 74 65 72 6e 69 6f 6e 2c | 20 76 65 63 74 28 30 2c |ternion,| vect(0,|
|000013f0| 20 30 2c 20 31 29 29 3b | 0d 0a 0d 0a 09 2f 2f 20 | 0, 1));|.....// |
|00001400| 47 65 74 20 72 6f 6f 74 | 20 63 68 61 73 73 69 73 |Get root| chassis|
|00001410| 20 69 6e 66 6f 0d 0a 09 | 43 68 61 73 73 69 73 53 | info...|ChassisS|
|00001420| 74 61 74 65 2e 50 6f 73 | 69 74 69 6f 6e 20 3d 20 |tate.Pos|ition = |
|00001430| 43 61 72 53 74 61 74 65 | 2e 43 68 61 73 73 69 73 |CarState|.Chassis|
|00001440| 50 6f 73 69 74 69 6f 6e | 3b 0d 0a 09 43 68 61 73 |Position|;...Chas|
|00001450| 73 69 73 53 74 61 74 65 | 2e 51 75 61 74 65 72 6e |sisState|.Quatern|
|00001460| 69 6f 6e 20 3d 20 43 61 | 72 53 74 61 74 65 2e 43 |ion = Ca|rState.C|
|00001470| 68 61 73 73 69 73 51 75 | 61 74 65 72 6e 69 6f 6e |hassisQu|aternion|
|00001480| 3b 0d 0a 09 43 68 61 73 | 73 69 73 53 74 61 74 65 |;...Chas|sisState|
|00001490| 2e 4c 69 6e 56 65 6c 20 | 3d 20 43 61 72 53 74 61 |.LinVel |= CarSta|
|000014a0| 74 65 2e 43 68 61 73 73 | 69 73 4c 69 6e 56 65 6c |te.Chass|isLinVel|
|000014b0| 3b 0d 0a 09 43 68 61 73 | 73 69 73 53 74 61 74 65 |;...Chas|sisState|
|000014c0| 2e 41 6e 67 56 65 6c 20 | 3d 20 43 61 72 53 74 61 |.AngVel |= CarSta|
|000014d0| 74 65 2e 43 68 61 73 73 | 69 73 41 6e 67 56 65 6c |te.Chass|isAngVel|
|000014e0| 3b 0d 0a 09 0d 0a 0d 0a | 09 2f 2f 20 46 69 67 75 |;.......|.// Figu|
|000014f0| 72 65 20 6f 75 74 20 6e | 65 77 20 73 74 61 74 65 |re out n|ew state|
|00001500| 20 6f 66 20 77 68 65 65 | 6c 73 0d 0a 0d 0a 09 2f | of whee|ls...../|
|00001510| 2f 20 57 68 65 65 6c 20 | 70 6f 73 69 74 69 6f 6e |/ Wheel |position|
|00001520| 73 20 61 72 65 20 6f 6e | 6c 79 20 73 75 70 70 6c |s are on|ly suppl|
|00001530| 69 65 64 20 77 69 74 68 | 20 61 20 63 68 61 73 73 |ied with| a chass|
|00001540| 69 73 2d 73 70 61 63 65 | 20 5a 20 28 76 65 72 74 |is-space| Z (vert|
|00001550| 69 63 61 6c 29 20 76 61 | 6c 75 65 20 2d 20 58 20 |ical) va|lue - X |
|00001560| 61 6e 64 20 59 20 61 72 | 65 20 61 73 73 75 6d 65 |and Y ar|e assume|
|00001570| 64 20 6e 6f 20 74 6f 20 | 63 68 61 6e 67 65 0d 0a |d no to |change..|
|00001580| 09 2f 2f 20 52 65 61 72 | 20 77 68 65 65 6c 20 6f |.// Rear| wheel o|
|00001590| 72 69 65 6e 74 61 74 69 | 6f 6e 73 20 61 72 65 20 |rientati|ons are |
|000015a0| 6e 6f 74 20 73 75 70 70 | 6c 69 65 64 2e 20 54 68 |not supp|lied. Th|
|000015b0| 65 20 6f 6e 6c 79 20 63 | 6f 6e 73 74 72 61 69 6e |e only c|onstrain|
|000015c0| 74 20 69 73 20 74 68 65 | 69 72 20 59 2d 61 78 69 |t is the|ir Y-axi|
|000015d0| 73 20 28 61 78 6c 65 29 | 20 69 73 20 70 61 72 61 |s (axle)| is para|
|000015e0| 6c 6c 65 6c 20 74 6f 20 | 0d 0a 09 2f 2f 20 74 68 |llel to |...// th|
|000015f0| 65 20 63 68 61 73 73 69 | 73 20 59 2d 61 78 69 73 |e chassi|s Y-axis|
|00001600| 2e 20 41 20 71 75 61 74 | 65 72 6e 69 6f 6e 20 69 |. A quat|ernion i|
|00001610| 73 20 63 61 6c 63 75 6c | 61 74 65 64 20 74 6f 20 |s calcul|ated to |
|00001620| 67 6f 20 66 72 6f 6d 20 | 63 75 72 72 65 6e 74 20 |go from |current |
|00001630| 6f 72 69 65 6e 74 61 74 | 69 6f 6e 20 74 6f 20 66 |orientat|ion to f|
|00001640| 75 6c 66 69 6c 20 74 68 | 61 74 20 63 72 69 74 65 |ulfil th|at crite|
|00001650| 72 69 61 2c 20 77 68 69 | 63 68 0d 0a 09 2f 2f 20 |ria, whi|ch...// |
|00001660| 73 68 6f 75 6c 64 20 70 | 72 6f 64 75 63 65 20 6d |should p|roduce m|
|00001670| 69 6e 69 6d 75 6d 20 64 | 69 66 66 65 72 65 6e 63 |inimum d|ifferenc|
|00001680| 65 20 74 6f 20 74 68 65 | 20 27 72 6f 6c 6c 27 20 |e to the| 'roll' |
|00001690| 6f 66 20 74 68 65 20 77 | 68 65 65 6c 20 2d 20 77 |of the w|heel - w|
|000016a0| 68 69 63 68 20 69 73 20 | 61 6c 6c 6f 77 65 64 20 |hich is |allowed |
|000016b0| 74 6f 20 64 69 66 66 65 | 72 20 6f 6e 20 73 65 72 |to diffe|r on ser|
|000016c0| 76 65 72 20 61 6e 64 20 | 63 6c 69 65 6e 74 2e 0d |ver and |client..|
|000016d0| 0a 09 2f 2f 20 46 6f 72 | 20 66 72 6f 6e 74 20 77 |..// For| front w|
|000016e0| 68 65 65 6c 20 77 65 20 | 64 6f 20 73 65 6e 64 20 |heel we |do send |
|000016f0| 74 68 65 20 63 75 72 72 | 65 6e 74 20 27 73 74 65 |the curr|ent 'ste|
|00001700| 65 72 69 6e 67 27 20 61 | 6e 67 6c 65 2e 20 54 68 |ering' a|ngle. Th|
|00001710| 61 74 20 69 73 20 61 64 | 64 65 64 20 61 66 74 65 |at is ad|ded afte|
|00001720| 72 20 74 68 65 20 61 62 | 6f 76 65 20 70 72 6f 63 |r the ab|ove proc|
|00001730| 65 73 73 20 61 73 20 61 | 20 71 75 61 74 65 72 6e |ess as a| quatern|
|00001740| 69 6f 6e 20 0d 0a 09 2f | 2f 20 61 72 6f 75 6e 64 |ion .../|/ around|
|00001750| 20 63 68 61 73 73 69 73 | 20 5a 20 28 75 70 29 2e | chassis| Z (up).|
|00001760| 0d 0a 09 2f 2f 20 46 6f | 72 20 6c 69 6e 65 61 72 |...// Fo|r linear|
|00001770| 20 76 65 6c 6f 63 69 74 | 79 20 6f 66 20 77 68 65 | velocit|y of whe|
|00001780| 65 6c 73 20 2d 20 63 61 | 6c 63 75 6c 61 74 65 20 |els - ca|lculate |
|00001790| 62 61 73 65 64 20 6f 6e | 20 6c 69 6e 65 61 72 20 |based on| linear |
|000017a0| 61 6e 64 20 61 6e 67 75 | 6c 61 72 20 76 65 6c 6f |and angu|lar velo|
|000017b0| 63 69 74 79 20 6f 66 20 | 63 68 61 73 73 69 73 2c |city of |chassis,|
|000017c0| 20 61 6e 64 20 61 64 64 | 20 6f 6e 20 76 65 72 74 | and add| on vert|
|000017d0| 69 63 61 6c 20 0d 0a 09 | 2f 2f 20 63 6f 6d 70 6f |ical ...|// compo|
|000017e0| 6e 65 6e 74 20 73 65 6e | 74 20 6f 76 65 72 20 74 |nent sen|t over t|
|000017f0| 68 65 20 6e 65 74 2e 0d | 0a 0d 0a 09 2f 2f 2f 2f |he net..|....////|
|00001800| 2f 2f 2f 2f 2f 2f 2f 2f | 2f 2f 2f 2f 2f 2f 2f 2f |////////|////////|
|00001810| 2f 2f 2f 2f 2f 2f 20 46 | 52 4f 4e 54 20 4c 45 46 |////// F|RONT LEF|
|00001820| 54 20 2f 2f 2f 2f 2f 2f | 2f 2f 2f 2f 2f 2f 2f 2f |T //////|////////|
|00001830| 2f 2f 2f 2f 2f 2f 2f 2f | 2f 2f 2f 2f 0d 0a 09 66 |////////|////...f|
|00001840| 72 6f 6e 74 4c 65 66 74 | 2e 4b 47 65 74 52 69 67 |rontLeft|.KGetRig|
|00001850| 69 64 42 6f 64 79 53 74 | 61 74 65 28 66 72 6f 6e |idBodySt|ate(fron|
|00001860| 74 4c 65 66 74 2e 52 65 | 63 65 69 76 65 53 74 61 |tLeft.Re|ceiveSta|
|00001870| 74 65 29 3b 0d 0a 0d 0a | 09 2f 2f 20 50 6f 73 69 |te);....|.// Posi|
|00001880| 74 69 6f 6e 0d 0a 09 6c | 50 6f 73 2e 58 20 3d 20 |tion...l|Pos.X = |
|00001890| 57 68 65 65 6c 46 72 6f | 6e 74 41 6c 6f 6e 67 3b |WheelFro|ntAlong;|
|000018a0| 0d 0a 09 6c 50 6f 73 2e | 59 20 3d 20 57 68 65 65 |...lPos.|Y = Whee|
|000018b0| 6c 46 72 6f 6e 74 41 63 | 72 6f 73 73 3b 0d 0a 09 |lFrontAc|ross;...|
|000018c0| 6c 50 6f 73 2e 5a 20 3d | 20 43 61 72 53 74 61 74 |lPos.Z =| CarStat|
|000018d0| 65 2e 57 68 65 65 6c 48 | 65 69 67 68 74 5b 30 5d |e.WheelH|eight[0]|
|000018e0| 3b 0d 0a 09 63 61 6c 63 | 50 6f 73 20 3d 20 63 68 |;...calc|Pos = ch|
|000018f0| 61 73 73 69 73 50 6f 73 | 20 2b 20 51 75 61 74 52 |assisPos| + QuatR|
|00001900| 6f 74 61 74 65 56 65 63 | 74 6f 72 28 43 61 72 53 |otateVec|tor(CarS|
|00001910| 74 61 74 65 2e 43 68 61 | 73 73 69 73 51 75 61 74 |tate.Cha|ssisQuat|
|00001920| 65 72 6e 69 6f 6e 2c 20 | 6c 50 6f 73 29 3b 20 2f |ernion, |lPos); /|
|00001930| 2f 20 43 6f 6e 76 65 72 | 74 20 66 72 6f 6d 20 63 |/ Conver|t from c|
|00001940| 68 61 73 73 69 73 20 73 | 74 61 74 65 20 74 6f 20 |hassis s|tate to |
|00001950| 77 6f 72 6c 64 20 73 70 | 61 63 65 0d 0a 09 66 72 |world sp|ace...fr|
|00001960| 6f 6e 74 4c 65 66 74 2e | 52 65 63 65 69 76 65 53 |ontLeft.|ReceiveS|
|00001970| 74 61 74 65 2e 50 6f 73 | 69 74 69 6f 6e 20 3d 20 |tate.Pos|ition = |
|00001980| 4b 52 42 56 65 63 46 72 | 6f 6d 56 65 63 74 6f 72 |KRBVecFr|omVector|
|00001990| 28 63 61 6c 63 50 6f 73 | 29 3b 0d 0a 0d 0a 09 2f |(calcPos|);...../|
|000019a0| 2f 20 52 6f 74 61 74 69 | 6f 6e 0d 0a 09 77 68 65 |/ Rotati|on...whe|
|000019b0| 65 6c 51 20 3d 20 66 72 | 6f 6e 74 4c 65 66 74 2e |elQ = fr|ontLeft.|
|000019c0| 4b 47 65 74 52 42 51 75 | 61 74 65 72 6e 69 6f 6e |KGetRBQu|aternion|
|000019d0| 28 29 3b 0d 0a 09 57 68 | 65 65 6c 59 20 3d 20 51 |();...Wh|eelY = Q|
|000019e0| 75 61 74 52 6f 74 61 74 | 65 56 65 63 74 6f 72 28 |uatRotat|eVector(|
|000019f0| 77 68 65 65 6c 51 2c 20 | 76 65 63 74 28 30 2c 20 |wheelQ, |vect(0, |
|00001a00| 31 2c 20 30 29 29 3b 0d | 0a 09 53 74 65 65 72 59 |1, 0));.|..SteerY|
|00001a10| 20 3d 20 51 75 61 74 52 | 6f 74 61 74 65 56 65 63 | = QuatR|otateVec|
|00001a20| 74 6f 72 28 20 51 75 61 | 74 46 72 6f 6d 41 78 69 |tor( Qua|tFromAxi|
|00001a30| 73 41 6e 64 41 6e 67 6c | 65 28 43 68 61 73 73 69 |sAndAngl|e(Chassi|
|00001a40| 73 5a 2c 20 43 61 72 53 | 74 61 74 65 2e 46 72 6f |sZ, CarS|tate.Fro|
|00001a50| 6e 74 57 68 65 65 6c 41 | 6e 67 5b 30 5d 29 2c 20 |ntWheelA|ng[0]), |
|00001a60| 43 68 61 73 73 69 73 59 | 20 29 3b 0d 0a 09 72 65 |ChassisY| );...re|
|00001a70| 6c 51 20 3d 20 51 75 61 | 74 46 69 6e 64 42 65 74 |lQ = Qua|tFindBet|
|00001a80| 77 65 65 6e 28 57 68 65 | 65 6c 59 2c 20 53 74 65 |ween(Whe|elY, Ste|
|00001a90| 65 72 59 29 3b 0d 0a 09 | 66 72 6f 6e 74 4c 65 66 |erY);...|frontLef|
|00001aa0| 74 2e 52 65 63 65 69 76 | 65 53 74 61 74 65 2e 51 |t.Receiv|eState.Q|
|00001ab0| 75 61 74 65 72 6e 69 6f | 6e 20 3d 20 51 75 61 74 |uaternio|n = Quat|
|00001ac0| 50 72 6f 64 75 63 74 28 | 72 65 6c 51 2c 20 77 68 |Product(|relQ, wh|
|00001ad0| 65 65 6c 51 29 3b 0d 0a | 0d 0a 09 2f 2f 20 56 65 |eelQ);..|...// Ve|
|00001ae0| 6c 6f 63 69 74 79 0d 0a | 09 77 50 6f 73 52 65 6c |locity..|.wPosRel|
|00001af0| 20 3d 20 63 61 6c 63 50 | 6f 73 20 2d 20 63 68 61 | = calcP|os - cha|
|00001b00| 73 73 69 73 50 6f 73 3b | 0d 0a 09 57 68 65 65 6c |ssisPos;|...Wheel|
|00001b10| 4c 69 6e 56 65 6c 20 3d | 20 63 68 61 73 73 69 73 |LinVel =| chassis|
|00001b20| 4c 69 6e 56 65 6c 20 2b | 20 28 63 68 61 73 73 69 |LinVel +| (chassi|
|00001b30| 73 41 6e 67 56 65 6c 20 | 43 72 6f 73 73 20 77 50 |sAngVel |Cross wP|
|00001b40| 6f 73 52 65 6c 29 3b 0d | 0a 09 57 68 65 65 6c 4c |osRel);.|..WheelL|
|00001b50| 69 6e 56 65 6c 20 2b 3d | 20 43 61 72 53 74 61 74 |inVel +=| CarStat|
|00001b60| 65 2e 57 68 65 65 6c 56 | 65 72 74 56 65 6c 5b 30 |e.WheelV|ertVel[0|
|00001b70| 5d 20 2a 20 43 68 61 73 | 73 69 73 5a 3b 0d 0a 09 |] * Chas|sisZ;...|
|00001b80| 66 72 6f 6e 74 4c 65 66 | 74 2e 52 65 63 65 69 76 |frontLef|t.Receiv|
|00001b90| 65 53 74 61 74 65 2e 4c | 69 6e 56 65 6c 20 3d 20 |eState.L|inVel = |
|00001ba0| 4b 52 42 56 65 63 46 72 | 6f 6d 56 65 63 74 6f 72 |KRBVecFr|omVector|
|00001bb0| 28 57 68 65 65 6c 4c 69 | 6e 56 65 6c 29 3b 0d 0a |(WheelLi|nVel);..|
|00001bc0| 0d 0a 09 2f 2f 66 72 6f | 6e 74 4c 65 66 74 2e 52 |...//fro|ntLeft.R|
|00001bd0| 65 63 65 69 76 65 53 74 | 61 74 65 2e 41 6e 67 56 |eceiveSt|ate.AngV|
|00001be0| 65 6c 20 3d 20 4b 52 42 | 56 65 63 46 72 6f 6d 56 |el = KRB|VecFromV|
|00001bf0| 65 63 74 6f 72 28 63 68 | 61 73 73 69 73 41 6e 67 |ector(ch|assisAng|
|00001c00| 56 65 6c 20 2b 20 28 57 | 68 65 65 6c 59 20 2a 20 |Vel + (W|heelY * |
|00001c10| 43 61 72 53 74 61 74 65 | 2e 57 68 65 65 6c 53 70 |CarState|.WheelSp|
|00001c20| 69 6e 56 65 6c 5b 30 5d | 29 29 3b 0d 0a 0d 0a 09 |inVel[0]|));.....|
|00001c30| 66 72 6f 6e 74 4c 65 66 | 74 2e 62 52 65 63 65 69 |frontLef|t.bRecei|
|00001c40| 76 65 53 74 61 74 65 4e | 65 77 20 3d 20 74 72 75 |veStateN|ew = tru|
|00001c50| 65 3b 0d 0a 0d 0a 09 2f | 2f 2f 2f 2f 2f 2f 2f 2f |e;...../|////////|
|00001c60| 2f 2f 2f 2f 2f 2f 2f 2f | 2f 2f 2f 2f 2f 2f 2f 2f |////////|////////|
|00001c70| 2f 20 46 52 4f 4e 54 20 | 52 49 47 48 54 20 2f 2f |/ FRONT |RIGHT //|
|00001c80| 2f 2f 2f 2f 2f 2f 2f 2f | 2f 2f 2f 2f 2f 2f 2f 2f |////////|////////|
|00001c90| 2f 2f 2f 2f 2f 2f 2f 2f | 0d 0a 09 66 72 6f 6e 74 |////////|...front|
|00001ca0| 52 69 67 68 74 2e 4b 47 | 65 74 52 69 67 69 64 42 |Right.KG|etRigidB|
|00001cb0| 6f 64 79 53 74 61 74 65 | 28 66 72 6f 6e 74 52 69 |odyState|(frontRi|
|00001cc0| 67 68 74 2e 52 65 63 65 | 69 76 65 53 74 61 74 65 |ght.Rece|iveState|
|00001cd0| 29 3b 0d 0a 0d 0a 09 2f | 2f 20 50 6f 73 69 74 69 |);...../|/ Positi|
|00001ce0| 6f 6e 0d 0a 09 6c 50 6f | 73 2e 58 20 3d 20 57 68 |on...lPo|s.X = Wh|
|00001cf0| 65 65 6c 46 72 6f 6e 74 | 41 6c 6f 6e 67 3b 0d 0a |eelFront|Along;..|
|00001d00| 09 6c 50 6f 73 2e 59 20 | 3d 20 2d 57 68 65 65 6c |.lPos.Y |= -Wheel|
|00001d10| 46 72 6f 6e 74 41 63 72 | 6f 73 73 3b 0d 0a 09 6c |FrontAcr|oss;...l|
|00001d20| 50 6f 73 2e 5a 20 3d 20 | 43 61 72 53 74 61 74 65 |Pos.Z = |CarState|
|00001d30| 2e 57 68 65 65 6c 48 65 | 69 67 68 74 5b 31 5d 3b |.WheelHe|ight[1];|
|00001d40| 0d 0a 09 63 61 6c 63 50 | 6f 73 20 3d 20 63 68 61 |...calcP|os = cha|
|00001d50| 73 73 69 73 50 6f 73 20 | 2b 20 51 75 61 74 52 6f |ssisPos |+ QuatRo|
|00001d60| 74 61 74 65 56 65 63 74 | 6f 72 28 43 61 72 53 74 |tateVect|or(CarSt|
|00001d70| 61 74 65 2e 43 68 61 73 | 73 69 73 51 75 61 74 65 |ate.Chas|sisQuate|
|00001d80| 72 6e 69 6f 6e 2c 20 6c | 50 6f 73 29 3b 0d 0a 09 |rnion, l|Pos);...|
|00001d90| 66 72 6f 6e 74 52 69 67 | 68 74 2e 52 65 63 65 69 |frontRig|ht.Recei|
|00001da0| 76 65 53 74 61 74 65 2e | 50 6f 73 69 74 69 6f 6e |veState.|Position|
|00001db0| 20 3d 20 4b 52 42 56 65 | 63 46 72 6f 6d 56 65 63 | = KRBVe|cFromVec|
|00001dc0| 74 6f 72 28 63 61 6c 63 | 50 6f 73 29 3b 0d 0a 0d |tor(calc|Pos);...|
|00001dd0| 0a 0d 0a 09 2f 2f 20 52 | 6f 74 61 74 69 6f 6e 0d |....// R|otation.|
|00001de0| 0a 09 77 68 65 65 6c 51 | 20 3d 20 66 72 6f 6e 74 |..wheelQ| = front|
|00001df0| 52 69 67 68 74 2e 4b 47 | 65 74 52 42 51 75 61 74 |Right.KG|etRBQuat|
|00001e00| 65 72 6e 69 6f 6e 28 29 | 3b 0d 0a 09 57 68 65 65 |ernion()|;...Whee|
|00001e10| 6c 59 20 3d 20 51 75 61 | 74 52 6f 74 61 74 65 56 |lY = Qua|tRotateV|
|00001e20| 65 63 74 6f 72 28 77 68 | 65 65 6c 51 2c 20 76 65 |ector(wh|eelQ, ve|
|00001e30| 63 74 28 30 2c 20 31 2c | 20 30 29 29 3b 0d 0a 09 |ct(0, 1,| 0));...|
|00001e40| 53 74 65 65 72 59 20 3d | 20 51 75 61 74 52 6f 74 |SteerY =| QuatRot|
|00001e50| 61 74 65 56 65 63 74 6f | 72 28 20 51 75 61 74 46 |ateVecto|r( QuatF|
|00001e60| 72 6f 6d 41 78 69 73 41 | 6e 64 41 6e 67 6c 65 28 |romAxisA|ndAngle(|
|00001e70| 43 68 61 73 73 69 73 5a | 2c 20 43 61 72 53 74 61 |ChassisZ|, CarSta|
|00001e80| 74 65 2e 46 72 6f 6e 74 | 57 68 65 65 6c 41 6e 67 |te.Front|WheelAng|
|00001e90| 5b 31 5d 29 2c 20 43 68 | 61 73 73 69 73 59 20 29 |[1]), Ch|assisY )|
|00001ea0| 3b 0d 0a 09 72 65 6c 51 | 20 3d 20 51 75 61 74 46 |;...relQ| = QuatF|
|00001eb0| 69 6e 64 42 65 74 77 65 | 65 6e 28 57 68 65 65 6c |indBetwe|en(Wheel|
|00001ec0| 59 2c 20 53 74 65 65 72 | 59 29 3b 0d 0a 09 66 72 |Y, Steer|Y);...fr|
|00001ed0| 6f 6e 74 52 69 67 68 74 | 2e 52 65 63 65 69 76 65 |ontRight|.Receive|
|00001ee0| 53 74 61 74 65 2e 51 75 | 61 74 65 72 6e 69 6f 6e |State.Qu|aternion|
|00001ef0| 20 3d 20 51 75 61 74 50 | 72 6f 64 75 63 74 28 72 | = QuatP|roduct(r|
|00001f00| 65 6c 51 2c 20 77 68 65 | 65 6c 51 29 3b 0d 0a 0d |elQ, whe|elQ);...|
|00001f10| 0a 09 2f 2f 20 56 65 6c | 6f 63 69 74 79 0d 0a 09 |..// Vel|ocity...|
|00001f20| 77 50 6f 73 52 65 6c 20 | 3d 20 63 61 6c 63 50 6f |wPosRel |= calcPo|
|00001f30| 73 20 2d 20 63 68 61 73 | 73 69 73 50 6f 73 3b 0d |s - chas|sisPos;.|
|00001f40| 0a 09 57 68 65 65 6c 4c | 69 6e 56 65 6c 20 3d 20 |..WheelL|inVel = |
|00001f50| 63 68 61 73 73 69 73 4c | 69 6e 56 65 6c 20 2b 20 |chassisL|inVel + |
|00001f60| 28 63 68 61 73 73 69 73 | 41 6e 67 56 65 6c 20 43 |(chassis|AngVel C|
|00001f70| 72 6f 73 73 20 77 50 6f | 73 52 65 6c 29 3b 0d 0a |ross wPo|sRel);..|
|00001f80| 09 57 68 65 65 6c 4c 69 | 6e 56 65 6c 20 2b 3d 20 |.WheelLi|nVel += |
|00001f90| 43 61 72 53 74 61 74 65 | 2e 57 68 65 65 6c 56 65 |CarState|.WheelVe|
|00001fa0| 72 74 56 65 6c 5b 31 5d | 20 2a 20 43 68 61 73 73 |rtVel[1]| * Chass|
|00001fb0| 69 73 5a 3b 0d 0a 09 66 | 72 6f 6e 74 52 69 67 68 |isZ;...f|rontRigh|
|00001fc0| 74 2e 52 65 63 65 69 76 | 65 53 74 61 74 65 2e 4c |t.Receiv|eState.L|
|00001fd0| 69 6e 56 65 6c 20 3d 20 | 4b 52 42 56 65 63 46 72 |inVel = |KRBVecFr|
|00001fe0| 6f 6d 56 65 63 74 6f 72 | 28 57 68 65 65 6c 4c 69 |omVector|(WheelLi|
|00001ff0| 6e 56 65 6c 29 3b 0d 0a | 0d 0a 09 2f 2f 66 72 6f |nVel);..|...//fro|
|00002000| 6e 74 52 69 67 68 74 2e | 52 65 63 65 69 76 65 53 |ntRight.|ReceiveS|
|00002010| 74 61 74 65 2e 41 6e 67 | 56 65 6c 20 3d 20 4b 52 |tate.Ang|Vel = KR|
|00002020| 42 56 65 63 46 72 6f 6d | 56 65 63 74 6f 72 28 63 |BVecFrom|Vector(c|
|00002030| 68 61 73 73 69 73 41 6e | 67 56 65 6c 20 2b 20 28 |hassisAn|gVel + (|
|00002040| 57 68 65 65 6c 59 20 2a | 20 43 61 72 53 74 61 74 |WheelY *| CarStat|
|00002050| 65 2e 57 68 65 65 6c 53 | 70 69 6e 56 65 6c 5b 31 |e.WheelS|pinVel[1|
|00002060| 5d 29 29 3b 0d 0a 0d 0a | 09 66 72 6f 6e 74 52 69 |]));....|.frontRi|
|00002070| 67 68 74 2e 62 52 65 63 | 65 69 76 65 53 74 61 74 |ght.bRec|eiveStat|
|00002080| 65 4e 65 77 20 3d 20 74 | 72 75 65 3b 0d 0a 0d 0a |eNew = t|rue;....|
|00002090| 09 2f 2f 2f 2f 2f 2f 2f | 2f 2f 2f 2f 2f 2f 2f 2f |.///////|////////|
|000020a0| 2f 2f 2f 2f 2f 2f 2f 2f | 2f 2f 2f 20 52 45 41 52 |////////|/// REAR|
|000020b0| 20 4c 45 46 54 20 2f 2f | 2f 2f 2f 2f 2f 2f 2f 2f | LEFT //|////////|
|000020c0| 2f 2f 2f 2f 2f 2f 2f 2f | 2f 2f 2f 2f 2f 2f 2f 2f |////////|////////|
|000020d0| 0d 0a 09 72 65 61 72 4c | 65 66 74 2e 4b 47 65 74 |...rearL|eft.KGet|
|000020e0| 52 69 67 69 64 42 6f 64 | 79 53 74 61 74 65 28 72 |RigidBod|yState(r|
|000020f0| 65 61 72 4c 65 66 74 2e | 52 65 63 65 69 76 65 53 |earLeft.|ReceiveS|
|00002100| 74 61 74 65 29 3b 0d 0a | 0d 0a 09 2f 2f 20 50 6f |tate);..|...// Po|
|00002110| 73 69 74 69 6f 6e 0d 0a | 09 6c 50 6f 73 2e 58 20 |sition..|.lPos.X |
|00002120| 3d 20 57 68 65 65 6c 52 | 65 61 72 41 6c 6f 6e 67 |= WheelR|earAlong|
|00002130| 3b 0d 0a 09 6c 50 6f 73 | 2e 59 20 3d 20 57 68 65 |;...lPos|.Y = Whe|
|00002140| 65 6c 46 72 6f 6e 74 41 | 63 72 6f 73 73 3b 0d 0a |elFrontA|cross;..|
|00002150| 09 6c 50 6f 73 2e 5a 20 | 3d 20 43 61 72 53 74 61 |.lPos.Z |= CarSta|
|00002160| 74 65 2e 57 68 65 65 6c | 48 65 69 67 68 74 5b 32 |te.Wheel|Height[2|
|00002170| 5d 3b 0d 0a 09 63 61 6c | 63 50 6f 73 20 3d 20 63 |];...cal|cPos = c|
|00002180| 68 61 73 73 69 73 50 6f | 73 20 2b 20 51 75 61 74 |hassisPo|s + Quat|
|00002190| 52 6f 74 61 74 65 56 65 | 63 74 6f 72 28 43 61 72 |RotateVe|ctor(Car|
|000021a0| 53 74 61 74 65 2e 43 68 | 61 73 73 69 73 51 75 61 |State.Ch|assisQua|
|000021b0| 74 65 72 6e 69 6f 6e 2c | 20 6c 50 6f 73 29 3b 0d |ternion,| lPos);.|
|000021c0| 0a 09 72 65 61 72 4c 65 | 66 74 2e 52 65 63 65 69 |..rearLe|ft.Recei|
|000021d0| 76 65 53 74 61 74 65 2e | 50 6f 73 69 74 69 6f 6e |veState.|Position|
|000021e0| 20 3d 20 4b 52 42 56 65 | 63 46 72 6f 6d 56 65 63 | = KRBVe|cFromVec|
|000021f0| 74 6f 72 28 63 61 6c 63 | 50 6f 73 29 3b 0d 0a 0d |tor(calc|Pos);...|
|00002200| 0a 0d 0a 09 2f 2f 20 52 | 6f 74 61 74 69 6f 6e 0d |....// R|otation.|
|00002210| 0a 09 77 68 65 65 6c 51 | 20 3d 20 72 65 61 72 4c |..wheelQ| = rearL|
|00002220| 65 66 74 2e 4b 47 65 74 | 52 42 51 75 61 74 65 72 |eft.KGet|RBQuater|
|00002230| 6e 69 6f 6e 28 29 3b 0d | 0a 09 57 68 65 65 6c 59 |nion();.|..WheelY|
|00002240| 20 3d 20 51 75 61 74 52 | 6f 74 61 74 65 56 65 63 | = QuatR|otateVec|
|00002250| 74 6f 72 28 77 68 65 65 | 6c 51 2c 20 76 65 63 74 |tor(whee|lQ, vect|
|00002260| 28 30 2c 20 31 2c 20 30 | 29 29 3b 0d 0a 09 72 65 |(0, 1, 0|));...re|
|00002270| 6c 51 20 3d 20 51 75 61 | 74 46 69 6e 64 42 65 74 |lQ = Qua|tFindBet|
|00002280| 77 65 65 6e 28 57 68 65 | 65 6c 59 2c 20 43 68 61 |ween(Whe|elY, Cha|
|00002290| 73 73 69 73 59 29 3b 0d | 0a 09 72 65 61 72 4c 65 |ssisY);.|..rearLe|
|000022a0| 66 74 2e 52 65 63 65 69 | 76 65 53 74 61 74 65 2e |ft.Recei|veState.|
|000022b0| 51 75 61 74 65 72 6e 69 | 6f 6e 20 3d 20 51 75 61 |Quaterni|on = Qua|
|000022c0| 74 50 72 6f 64 75 63 74 | 28 72 65 6c 51 2c 20 77 |tProduct|(relQ, w|
|000022d0| 68 65 65 6c 51 29 3b 0d | 0a 09 0d 0a 09 2f 2f 20 |heelQ);.|.....// |
|000022e0| 56 65 6c 6f 63 69 74 79 | 0d 0a 09 77 50 6f 73 52 |Velocity|...wPosR|
|000022f0| 65 6c 20 3d 20 63 61 6c | 63 50 6f 73 20 2d 20 63 |el = cal|cPos - c|
|00002300| 68 61 73 73 69 73 50 6f | 73 3b 0d 0a 09 57 68 65 |hassisPo|s;...Whe|
|00002310| 65 6c 4c 69 6e 56 65 6c | 20 3d 20 63 68 61 73 73 |elLinVel| = chass|
|00002320| 69 73 4c 69 6e 56 65 6c | 20 2b 20 28 63 68 61 73 |isLinVel| + (chas|
|00002330| 73 69 73 41 6e 67 56 65 | 6c 20 43 72 6f 73 73 20 |sisAngVe|l Cross |
|00002340| 77 50 6f 73 52 65 6c 29 | 3b 0d 0a 09 57 68 65 65 |wPosRel)|;...Whee|
|00002350| 6c 4c 69 6e 56 65 6c 20 | 2b 3d 20 43 61 72 53 74 |lLinVel |+= CarSt|
|00002360| 61 74 65 2e 57 68 65 65 | 6c 56 65 72 74 56 65 6c |ate.Whee|lVertVel|
|00002370| 5b 32 5d 20 2a 20 43 68 | 61 73 73 69 73 5a 3b 0d |[2] * Ch|assisZ;.|
|00002380| 0a 09 72 65 61 72 4c 65 | 66 74 2e 52 65 63 65 69 |..rearLe|ft.Recei|
|00002390| 76 65 53 74 61 74 65 2e | 4c 69 6e 56 65 6c 20 3d |veState.|LinVel =|
|000023a0| 20 4b 52 42 56 65 63 46 | 72 6f 6d 56 65 63 74 6f | KRBVecF|romVecto|
|000023b0| 72 28 57 68 65 65 6c 4c | 69 6e 56 65 6c 29 3b 0d |r(WheelL|inVel);.|
|000023c0| 0a 0d 0a 09 2f 2f 72 65 | 61 72 4c 65 66 74 2e 52 |....//re|arLeft.R|
|000023d0| 65 63 65 69 76 65 53 74 | 61 74 65 2e 41 6e 67 56 |eceiveSt|ate.AngV|
|000023e0| 65 6c 20 3d 20 4b 52 42 | 56 65 63 46 72 6f 6d 56 |el = KRB|VecFromV|
|000023f0| 65 63 74 6f 72 28 63 68 | 61 73 73 69 73 41 6e 67 |ector(ch|assisAng|
|00002400| 56 65 6c 20 2b 20 28 57 | 68 65 65 6c 59 20 2a 20 |Vel + (W|heelY * |
|00002410| 43 61 72 53 74 61 74 65 | 2e 57 68 65 65 6c 53 70 |CarState|.WheelSp|
|00002420| 69 6e 56 65 6c 5b 32 5d | 29 29 3b 0d 0a 0d 0a 09 |inVel[2]|));.....|
|00002430| 72 65 61 72 4c 65 66 74 | 2e 62 52 65 63 65 69 76 |rearLeft|.bReceiv|
|00002440| 65 53 74 61 74 65 4e 65 | 77 20 3d 20 74 72 75 65 |eStateNe|w = true|
|00002450| 3b 0d 0a 0d 0a 09 2f 2f | 2f 2f 2f 2f 2f 2f 2f 2f |;.....//|////////|
|00002460| 2f 2f 2f 2f 2f 2f 2f 2f | 2f 2f 2f 2f 2f 2f 2f 2f |////////|////////|
|00002470| 20 52 45 41 52 20 52 49 | 47 48 54 20 2f 2f 2f 2f | REAR RI|GHT ////|
|00002480| 2f 2f 2f 2f 2f 2f 2f 2f | 2f 2f 2f 2f 2f 2f 2f 2f |////////|////////|
|00002490| 2f 2f 2f 2f 2f 2f 0d 0a | 09 72 65 61 72 52 69 67 |//////..|.rearRig|
|000024a0| 68 74 2e 4b 47 65 74 52 | 69 67 69 64 42 6f 64 79 |ht.KGetR|igidBody|
|000024b0| 53 74 61 74 65 28 72 65 | 61 72 52 69 67 68 74 2e |State(re|arRight.|
|000024c0| 52 65 63 65 69 76 65 53 | 74 61 74 65 29 3b 0d 0a |ReceiveS|tate);..|
|000024d0| 0d 0a 09 2f 2f 20 50 6f | 73 69 74 69 6f 6e 0d 0a |...// Po|sition..|
|000024e0| 09 6c 50 6f 73 2e 58 20 | 3d 20 57 68 65 65 6c 52 |.lPos.X |= WheelR|
|000024f0| 65 61 72 41 6c 6f 6e 67 | 3b 0d 0a 09 6c 50 6f 73 |earAlong|;...lPos|
|00002500| 2e 59 20 3d 20 2d 57 68 | 65 65 6c 46 72 6f 6e 74 |.Y = -Wh|eelFront|
|00002510| 41 63 72 6f 73 73 3b 0d | 0a 09 6c 50 6f 73 2e 5a |Across;.|..lPos.Z|
|00002520| 20 3d 20 43 61 72 53 74 | 61 74 65 2e 57 68 65 65 | = CarSt|ate.Whee|
|00002530| 6c 48 65 69 67 68 74 5b | 33 5d 3b 0d 0a 09 63 61 |lHeight[|3];...ca|
|00002540| 6c 63 50 6f 73 20 3d 20 | 63 68 61 73 73 69 73 50 |lcPos = |chassisP|
|00002550| 6f 73 20 2b 20 51 75 61 | 74 52 6f 74 61 74 65 56 |os + Qua|tRotateV|
|00002560| 65 63 74 6f 72 28 43 61 | 72 53 74 61 74 65 2e 43 |ector(Ca|rState.C|
|00002570| 68 61 73 73 69 73 51 75 | 61 74 65 72 6e 69 6f 6e |hassisQu|aternion|
|00002580| 2c 20 6c 50 6f 73 29 3b | 0d 0a 09 72 65 61 72 52 |, lPos);|...rearR|
|00002590| 69 67 68 74 2e 52 65 63 | 65 69 76 65 53 74 61 74 |ight.Rec|eiveStat|
|000025a0| 65 2e 50 6f 73 69 74 69 | 6f 6e 20 3d 20 4b 52 42 |e.Positi|on = KRB|
|000025b0| 56 65 63 46 72 6f 6d 56 | 65 63 74 6f 72 28 63 61 |VecFromV|ector(ca|
|000025c0| 6c 63 50 6f 73 29 3b 0d | 0a 0d 0a 09 2f 2f 20 52 |lcPos);.|....// R|
|000025d0| 6f 74 61 74 69 6f 6e 0d | 0a 09 77 68 65 65 6c 51 |otation.|..wheelQ|
|000025e0| 20 3d 20 72 65 61 72 52 | 69 67 68 74 2e 4b 47 65 | = rearR|ight.KGe|
|000025f0| 74 52 42 51 75 61 74 65 | 72 6e 69 6f 6e 28 29 3b |tRBQuate|rnion();|
|00002600| 0d 0a 09 57 68 65 65 6c | 59 20 3d 20 51 75 61 74 |...Wheel|Y = Quat|
|00002610| 52 6f 74 61 74 65 56 65 | 63 74 6f 72 28 77 68 65 |RotateVe|ctor(whe|
|00002620| 65 6c 51 2c 20 76 65 63 | 74 28 30 2c 20 31 2c 20 |elQ, vec|t(0, 1, |
|00002630| 30 29 29 3b 0d 0a 09 72 | 65 6c 51 20 3d 20 51 75 |0));...r|elQ = Qu|
|00002640| 61 74 46 69 6e 64 42 65 | 74 77 65 65 6e 28 57 68 |atFindBe|tween(Wh|
|00002650| 65 65 6c 59 2c 20 43 68 | 61 73 73 69 73 59 29 3b |eelY, Ch|assisY);|
|00002660| 0d 0a 09 72 65 61 72 52 | 69 67 68 74 2e 52 65 63 |...rearR|ight.Rec|
|00002670| 65 69 76 65 53 74 61 74 | 65 2e 51 75 61 74 65 72 |eiveStat|e.Quater|
|00002680| 6e 69 6f 6e 20 3d 20 51 | 75 61 74 50 72 6f 64 75 |nion = Q|uatProdu|
|00002690| 63 74 28 72 65 6c 51 2c | 20 77 68 65 65 6c 51 29 |ct(relQ,| wheelQ)|
|000026a0| 3b 0d 0a 0d 0a 09 2f 2f | 20 56 65 6c 6f 63 69 74 |;.....//| Velocit|
|000026b0| 79 0d 0a 09 77 50 6f 73 | 52 65 6c 20 3d 20 63 61 |y...wPos|Rel = ca|
|000026c0| 6c 63 50 6f 73 20 2d 20 | 63 68 61 73 73 69 73 50 |lcPos - |chassisP|
|000026d0| 6f 73 3b 0d 0a 09 57 68 | 65 65 6c 4c 69 6e 56 65 |os;...Wh|eelLinVe|
|000026e0| 6c 20 3d 20 63 68 61 73 | 73 69 73 4c 69 6e 56 65 |l = chas|sisLinVe|
|000026f0| 6c 20 2b 20 28 63 68 61 | 73 73 69 73 41 6e 67 56 |l + (cha|ssisAngV|
|00002700| 65 6c 20 43 72 6f 73 73 | 20 77 50 6f 73 52 65 6c |el Cross| wPosRel|
|00002710| 29 3b 0d 0a 09 57 68 65 | 65 6c 4c 69 6e 56 65 6c |);...Whe|elLinVel|
|00002720| 20 2b 3d 20 43 61 72 53 | 74 61 74 65 2e 57 68 65 | += CarS|tate.Whe|
|00002730| 65 6c 56 65 72 74 56 65 | 6c 5b 33 5d 20 2a 20 43 |elVertVe|l[3] * C|
|00002740| 68 61 73 73 69 73 5a 3b | 0d 0a 09 72 65 61 72 52 |hassisZ;|...rearR|
|00002750| 69 67 68 74 2e 52 65 63 | 65 69 76 65 53 74 61 74 |ight.Rec|eiveStat|
|00002760| 65 2e 4c 69 6e 56 65 6c | 20 3d 20 4b 52 42 56 65 |e.LinVel| = KRBVe|
|00002770| 63 46 72 6f 6d 56 65 63 | 74 6f 72 28 57 68 65 65 |cFromVec|tor(Whee|
|00002780| 6c 4c 69 6e 56 65 6c 29 | 3b 0d 0a 0d 0a 09 2f 2f |lLinVel)|;.....//|
|00002790| 72 65 61 72 52 69 67 68 | 74 2e 52 65 63 65 69 76 |rearRigh|t.Receiv|
|000027a0| 65 53 74 61 74 65 2e 41 | 6e 67 56 65 6c 20 3d 20 |eState.A|ngVel = |
|000027b0| 4b 52 42 56 65 63 46 72 | 6f 6d 56 65 63 74 6f 72 |KRBVecFr|omVector|
|000027c0| 28 63 68 61 73 73 69 73 | 41 6e 67 56 65 6c 20 2b |(chassis|AngVel +|
|000027d0| 20 28 57 68 65 65 6c 59 | 20 2a 20 43 61 72 53 74 | (WheelY| * CarSt|
|000027e0| 61 74 65 2e 57 68 65 65 | 6c 53 70 69 6e 56 65 6c |ate.Whee|lSpinVel|
|000027f0| 5b 33 5d 29 29 3b 0d 0a | 0d 0a 09 72 65 61 72 52 |[3]));..|...rearR|
|00002800| 69 67 68 74 2e 62 52 65 | 63 65 69 76 65 53 74 61 |ight.bRe|ceiveSta|
|00002810| 74 65 4e 65 77 20 3d 20 | 74 72 75 65 3b 0d 0a 0d |teNew = |true;...|
|00002820| 0a 09 2f 2f 2f 2f 2f 2f | 20 4f 54 48 45 52 20 2f |..//////| OTHER /|
|00002830| 2f 2f 2f 2f 2f 0d 0a 0d | 0a 09 2f 2f 20 55 70 64 |/////...|..// Upd|
|00002840| 61 74 65 20 63 6f 6e 74 | 72 6f 6c 20 69 6e 70 75 |ate cont|rol inpu|
|00002850| 74 73 0d 0a 09 53 74 65 | 65 72 69 6e 67 20 3d 20 |ts...Ste|ering = |
|00002860| 43 61 72 53 74 61 74 65 | 2e 53 65 72 76 65 72 53 |CarState|.ServerS|
|00002870| 74 65 65 72 69 6e 67 3b | 0d 0a 09 4f 75 74 70 75 |teering;|...Outpu|
|00002880| 74 54 6f 72 71 75 65 20 | 3d 20 43 61 72 53 74 61 |tTorque |= CarSta|
|00002890| 74 65 2e 53 65 72 76 65 | 72 54 6f 72 71 75 65 3b |te.Serve|rTorque;|
|000028a0| 0d 0a 09 4f 75 74 70 75 | 74 42 72 61 6b 65 20 3d |...Outpu|tBrake =|
|000028b0| 20 43 61 72 53 74 61 74 | 65 2e 53 65 72 76 65 72 | CarStat|e.Server|
|000028c0| 42 72 61 6b 65 3b 0d 0a | 09 4f 75 74 70 75 74 48 |Brake;..|.OutputH|
|000028d0| 61 6e 64 62 72 61 6b 65 | 4f 6e 20 3d 20 43 61 72 |andbrake|On = Car|
|000028e0| 53 74 61 74 65 2e 53 65 | 72 76 65 72 48 61 6e 64 |State.Se|rverHand|
|000028f0| 62 72 61 6b 65 4f 6e 3b | 0d 0a 0d 0a 09 2f 2f 20 |brakeOn;|.....// |
|00002900| 55 70 64 61 74 65 20 66 | 6c 61 67 73 0d 0a 09 43 |Update f|lags...C|
|00002910| 61 72 53 74 61 74 65 2e | 62 4e 65 77 53 74 61 74 |arState.|bNewStat|
|00002920| 65 20 3d 20 66 61 6c 73 | 65 3b 0d 0a 09 62 4e 65 |e = fals|e;...bNe|
|00002930| 77 43 61 72 53 74 61 74 | 65 20 3d 20 74 72 75 65 |wCarStat|e = true|
|00002940| 3b 0d 0a 0d 0a 09 2f 2f | 20 46 6f 72 20 64 65 62 |;.....//| For deb|
|00002950| 75 67 67 69 6e 67 2e 2e | 2e 0d 0a 09 2f 2f 4b 44 |ugging..|....//KD|
|00002960| 72 61 77 52 69 67 69 64 | 42 6f 64 79 53 74 61 74 |rawRigid|BodyStat|
|00002970| 65 28 43 68 61 73 73 69 | 73 53 74 61 74 65 2c 20 |e(Chassi|sState, |
|00002980| 66 61 6c 73 65 29 3b 0d | 0a 09 2f 2f 4b 44 72 61 |false);.|..//KDra|
|00002990| 77 52 69 67 69 64 42 6f | 64 79 53 74 61 74 65 28 |wRigidBo|dyState(|
|000029a0| 66 72 6f 6e 74 4c 65 66 | 74 2e 52 65 63 65 69 76 |frontLef|t.Receiv|
|000029b0| 65 53 74 61 74 65 2c 20 | 66 61 6c 73 65 29 3b 0d |eState, |false);.|
|000029c0| 0a 09 2f 2f 4b 44 72 61 | 77 52 69 67 69 64 42 6f |..//KDra|wRigidBo|
|000029d0| 64 79 53 74 61 74 65 28 | 66 72 6f 6e 74 52 69 67 |dyState(|frontRig|
|000029e0| 68 74 2e 52 65 63 65 69 | 76 65 53 74 61 74 65 2c |ht.Recei|veState,|
|000029f0| 20 66 61 6c 73 65 29 3b | 0d 0a 09 2f 2f 4b 44 72 | false);|...//KDr|
|00002a00| 61 77 52 69 67 69 64 42 | 6f 64 79 53 74 61 74 65 |awRigidB|odyState|
|00002a10| 28 72 65 61 72 4c 65 66 | 74 2e 52 65 63 65 69 76 |(rearLef|t.Receiv|
|00002a20| 65 53 74 61 74 65 2c 20 | 66 61 6c 73 65 29 3b 0d |eState, |false);.|
|00002a30| 0a 09 2f 2f 4b 44 72 61 | 77 52 69 67 69 64 42 6f |..//KDra|wRigidBo|
|00002a40| 64 79 53 74 61 74 65 28 | 72 65 61 72 52 69 67 68 |dyState(|rearRigh|
|00002a50| 74 2e 52 65 63 65 69 76 | 65 53 74 61 74 65 2c 20 |t.Receiv|eState, |
|00002a60| 66 61 6c 73 65 29 3b 0d | 0a 7d 0d 0a 0d 0a 2f 2f |false);.|.}....//|
|00002a70| 20 54 68 69 73 20 6f 6e | 6c 79 20 75 70 64 61 74 | This on|ly updat|
|00002a80| 65 20 74 68 65 20 63 68 | 61 73 73 69 73 2e 20 54 |e the ch|assis. T|
|00002a90| 68 65 20 77 68 65 65 6c | 73 20 75 70 64 61 74 65 |he wheel|s update|
|00002aa0| 20 74 68 65 6d 73 65 6c | 76 65 73 2e 0d 0a 73 69 | themsel|ves...si|
|00002ab0| 6d 75 6c 61 74 65 64 20 | 65 76 65 6e 74 20 62 6f |mulated |event bo|
|00002ac0| 6f 6c 20 4b 55 70 64 61 | 74 65 53 74 61 74 65 28 |ol KUpda|teState(|
|00002ad0| 6f 75 74 20 4b 52 69 67 | 69 64 42 6f 64 79 53 74 |out KRig|idBodySt|
|00002ae0| 61 74 65 20 6e 65 77 53 | 74 61 74 65 29 0d 0a 7b |ate newS|tate)..{|
|00002af0| 0d 0a 09 2f 2f 20 54 68 | 69 73 20 73 68 6f 75 6c |...// Th|is shoul|
|00002b00| 64 20 6e 65 76 65 72 20 | 67 65 74 20 63 61 6c 6c |d never |get call|
|00002b10| 65 64 20 6f 6e 20 74 68 | 65 20 73 65 72 76 65 72 |ed on th|e server|
|00002b20| 20 2d 20 62 75 74 20 6a | 75 73 74 20 69 6e 20 63 | - but j|ust in c|
|00002b30| 61 73 65 21 0d 0a 09 69 | 66 28 52 6f 6c 65 20 3d |ase!...i|f(Role =|
|00002b40| 3d 20 52 4f 4c 45 5f 41 | 75 74 68 6f 72 69 74 79 |= ROLE_A|uthority|
|00002b50| 20 7c 7c 20 21 62 4e 65 | 77 43 61 72 53 74 61 74 | || !bNe|wCarStat|
|00002b60| 65 29 0d 0a 09 09 72 65 | 74 75 72 6e 20 66 61 6c |e)....re|turn fal|
|00002b70| 73 65 3b 0d 0a 09 09 0d | 0a 09 2f 2f 20 41 70 70 |se;.....|..// App|
|00002b80| 6c 79 20 72 65 63 65 69 | 76 65 64 20 64 61 74 61 |ly recei|ved data|
|00002b90| 20 61 73 20 6e 65 77 20 | 70 6f 73 69 74 69 6f 6e | as new |position|
|00002ba0| 20 6f 66 20 63 61 72 20 | 63 68 61 73 73 69 73 2e | of car |chassis.|
|00002bb0| 0d 0a 09 6e 65 77 53 74 | 61 74 65 20 3d 20 43 68 |...newSt|ate = Ch|
|00002bc0| 61 73 73 69 73 53 74 61 | 74 65 3b 0d 0a 09 62 4e |assisSta|te;...bN|
|00002bd0| 65 77 43 61 72 53 74 61 | 74 65 20 3d 20 66 61 6c |ewCarSta|te = fal|
|00002be0| 73 65 3b 0d 0a 0d 0a 09 | 72 65 74 75 72 6e 20 74 |se;.....|return t|
|00002bf0| 72 75 65 3b 0d 0a 09 2f | 2f 72 65 74 75 72 6e 20 |rue;.../|/return |
|00002c00| 66 61 6c 73 65 3b 0d 0a | 7d 0d 0a 0d 0a 2f 2f 20 |false;..|}....// |
|00002c10| 50 61 63 6b 20 63 75 72 | 72 65 6e 74 20 73 74 61 |Pack cur|rent sta|
|00002c20| 74 65 20 6f 66 20 77 68 | 6f 6c 65 20 63 61 72 20 |te of wh|ole car |
|00002c30| 69 6e 74 6f 20 74 68 65 | 20 73 74 61 74 65 20 73 |into the| state s|
|00002c40| 74 72 75 63 74 2c 20 74 | 6f 20 62 65 20 73 65 6e |truct, t|o be sen|
|00002c50| 74 20 74 6f 20 74 68 65 | 20 63 6c 69 65 6e 74 2e |t to the| client.|
|00002c60| 0d 0a 2f 2f 20 53 68 6f | 75 6c 64 20 6f 6e 6c 79 |..// Sho|uld only|
|00002c70| 20 67 65 74 20 63 61 6c | 6c 65 64 20 6f 6e 20 74 | get cal|led on t|
|00002c80| 68 65 20 73 65 72 76 65 | 72 2e 0d 0a 66 75 6e 63 |he serve|r...func|
|00002c90| 74 69 6f 6e 20 50 61 63 | 6b 53 74 61 74 65 28 29 |tion Pac|kState()|
|00002ca0| 0d 0a 7b 0d 0a 09 6c 6f | 63 61 6c 20 76 65 63 74 |..{...lo|cal vect|
|00002cb0| 6f 72 20 6c 50 6f 73 2c | 20 77 50 6f 73 2c 20 63 |or lPos,| wPos, c|
|00002cc0| 68 61 73 73 69 73 50 6f | 73 2c 20 63 68 61 73 73 |hassisPo|s, chass|
|00002cd0| 69 73 4c 69 6e 56 65 6c | 2c 20 63 68 61 73 73 69 |isLinVel|, chassi|
|00002ce0| 73 41 6e 67 56 65 6c 2c | 20 77 50 6f 73 52 65 6c |sAngVel,| wPosRel|
|00002cf0| 2c 20 57 68 65 65 6c 4c | 69 6e 56 65 6c 3b 0d 0a |, WheelL|inVel;..|
|00002d00| 09 6c 6f 63 61 6c 20 76 | 65 63 74 6f 72 20 43 68 |.local v|ector Ch|
|00002d10| 61 73 73 69 73 58 2c 20 | 43 68 61 73 73 69 73 5a |assisX, |ChassisZ|
|00002d20| 2c 20 57 68 65 65 6c 59 | 2c 20 6f 6c 64 50 6f 73 |, WheelY|, oldPos|
|00002d30| 2c 20 6f 6c 64 4c 69 6e | 56 65 6c 3b 0d 0a 09 6c |, oldLin|Vel;...l|
|00002d40| 6f 63 61 6c 20 4b 52 69 | 67 69 64 42 6f 64 79 53 |ocal KRi|gidBodyS|
|00002d50| 74 61 74 65 20 43 75 72 | 72 65 6e 74 43 68 61 73 |tate Cur|rentChas|
|00002d60| 73 69 73 53 74 61 74 65 | 2c 20 57 68 65 65 6c 53 |sisState|, WheelS|
|00002d70| 74 61 74 65 3b 0d 0a 0d | 0a 09 2f 2f 20 47 65 74 |tate;...|..// Get|
|00002d80| 20 63 68 61 73 73 69 73 | 20 73 74 61 74 65 2e 0d | chassis| state..|
|00002d90| 0a 09 4b 47 65 74 52 69 | 67 69 64 42 6f 64 79 53 |..KGetRi|gidBodyS|
|00002da0| 74 61 74 65 28 43 75 72 | 72 65 6e 74 43 68 61 73 |tate(Cur|rentChas|
|00002db0| 73 69 73 53 74 61 74 65 | 29 3b 0d 0a 0d 0a 09 63 |sisState|);.....c|
|00002dc0| 68 61 73 73 69 73 50 6f | 73 20 3d 20 4b 52 42 56 |hassisPo|s = KRBV|
|00002dd0| 65 63 54 6f 56 65 63 74 | 6f 72 28 43 75 72 72 65 |ecToVect|or(Curre|
|00002de0| 6e 74 43 68 61 73 73 69 | 73 53 74 61 74 65 2e 50 |ntChassi|sState.P|
|00002df0| 6f 73 69 74 69 6f 6e 29 | 3b 0d 0a 09 63 68 61 73 |osition)|;...chas|
|00002e00| 73 69 73 4c 69 6e 56 65 | 6c 20 3d 20 4b 52 42 56 |sisLinVe|l = KRBV|
|00002e10| 65 63 54 6f 56 65 63 74 | 6f 72 28 43 75 72 72 65 |ecToVect|or(Curre|
|00002e20| 6e 74 43 68 61 73 73 69 | 73 53 74 61 74 65 2e 4c |ntChassi|sState.L|
|00002e30| 69 6e 56 65 6c 29 3b 0d | 0a 09 63 68 61 73 73 69 |inVel);.|..chassi|
|00002e40| 73 41 6e 67 56 65 6c 20 | 3d 20 4b 52 42 56 65 63 |sAngVel |= KRBVec|
|00002e50| 54 6f 56 65 63 74 6f 72 | 28 43 75 72 72 65 6e 74 |ToVector|(Current|
|00002e60| 43 68 61 73 73 69 73 53 | 74 61 74 65 2e 41 6e 67 |ChassisS|tate.Ang|
|00002e70| 56 65 6c 29 3b 0d 0a 0d | 0a 09 2f 2f 20 4c 61 73 |Vel);...|..// Las|
|00002e80| 74 20 70 6f 73 69 74 69 | 6f 6e 20 77 65 20 73 65 |t positi|on we se|
|00002e90| 6e 74 0d 0a 09 6f 6c 64 | 50 6f 73 20 3d 20 4b 52 |nt...old|Pos = KR|
|00002ea0| 42 56 65 63 74 6f 56 65 | 63 74 6f 72 28 43 61 72 |BVectoVe|ctor(Car|
|00002eb0| 53 74 61 74 65 2e 43 68 | 61 73 73 69 73 50 6f 73 |State.Ch|assisPos|
|00002ec0| 69 74 69 6f 6e 29 3b 0d | 0a 09 6f 6c 64 4c 69 6e |ition);.|..oldLin|
|00002ed0| 56 65 6c 20 3d 20 4b 52 | 42 56 65 63 74 6f 56 65 |Vel = KR|BVectoVe|
|00002ee0| 63 74 6f 72 28 43 61 72 | 53 74 61 74 65 2e 43 68 |ctor(Car|State.Ch|
|00002ef0| 61 73 73 69 73 4c 69 6e | 56 65 6c 29 3b 0d 0a 0d |assisLin|Vel);...|
|00002f00| 0a 09 2f 2f 20 53 65 65 | 20 69 66 20 73 74 61 74 |..// See| if stat|
|00002f10| 65 20 68 61 73 20 63 68 | 61 6e 67 65 64 20 65 6e |e has ch|anged en|
|00002f20| 6f 75 67 68 2c 20 6f 72 | 20 65 6e 6f 75 67 68 20 |ough, or| enough |
|00002f30| 74 69 6d 65 20 68 61 73 | 20 70 61 73 73 65 64 2c |time has| passed,|
|00002f40| 20 74 68 61 74 20 77 65 | 20 0d 0a 09 2f 2f 20 73 | that we| ...// s|
|00002f50| 68 6f 75 6c 64 20 73 65 | 6e 64 20 6f 75 74 20 61 |hould se|nd out a|
|00002f60| 6e 6f 74 68 65 72 20 75 | 70 64 61 74 65 20 62 79 |nother u|pdate by|
|00002f70| 20 75 70 64 61 74 69 6e | 67 20 74 68 65 20 73 74 | updatin|g the st|
|00002f80| 61 74 65 20 73 74 72 75 | 63 74 2e 0d 0a 09 69 66 |ate stru|ct....if|
|00002f90| 28 20 21 4b 49 73 41 77 | 61 6b 65 28 29 20 29 0d |( !KIsAw|ake() ).|
|00002fa0| 0a 09 7b 0d 0a 09 09 72 | 65 74 75 72 6e 3b 20 2f |..{....r|eturn; /|
|00002fb0| 2f 20 4e 65 76 65 72 20 | 73 65 6e 64 20 75 70 64 |/ Never |send upd|
|00002fc0| 61 74 65 73 20 69 66 20 | 70 68 79 73 69 63 73 20 |ates if |physics |
|00002fd0| 69 73 20 61 74 20 72 65 | 73 74 0d 0a 09 7d 0d 0a |is at re|st...}..|
|00002fe0| 0d 0a 09 69 66 28 20 56 | 53 69 7a 65 28 6f 6c 64 |...if( V|Size(old|
|00002ff0| 50 6f 73 20 2d 20 63 68 | 61 73 73 69 73 50 6f 73 |Pos - ch|assisPos|
|00003000| 29 20 3e 20 35 20 7c 7c | 0d 0a 09 09 56 53 69 7a |) > 5 |||....VSiz|
|00003010| 65 28 6f 6c 64 4c 69 6e | 56 65 6c 20 2d 20 63 68 |e(oldLin|Vel - ch|
|00003020| 61 73 73 69 73 4c 69 6e | 56 65 6c 29 20 3e 20 31 |assisLin|Vel) > 1|
|00003030| 20 7c 7c 0d 0a 09 09 41 | 62 73 28 43 61 72 53 74 | ||....A|bs(CarSt|
|00003040| 61 74 65 2e 53 65 72 76 | 65 72 54 6f 72 71 75 65 |ate.Serv|erTorque|
|00003050| 20 2d 20 4f 75 74 70 75 | 74 54 6f 72 71 75 65 29 | - Outpu|tTorque)|
|00003060| 20 3e 20 30 2e 31 20 7c | 7c 0d 0a 09 09 41 62 73 | > 0.1 |||....Abs|
|00003070| 28 43 61 72 53 74 61 74 | 65 2e 53 65 72 76 65 72 |(CarStat|e.Server|
|00003080| 53 74 65 65 72 69 6e 67 | 20 2d 20 53 74 65 65 72 |Steering| - Steer|
|00003090| 69 6e 67 29 20 3e 20 30 | 2e 31 20 7c 7c 0d 0a 09 |ing) > 0|.1 ||...|
|000030a0| 09 4c 65 76 65 6c 2e 54 | 69 6d 65 53 65 63 6f 6e |.Level.T|imeSecon|
|000030b0| 64 73 20 3e 20 4e 65 78 | 74 4e 65 74 55 70 64 61 |ds > Nex|tNetUpda|
|000030c0| 74 65 54 69 6d 65 20 29 | 0d 0a 09 7b 0d 0a 09 09 |teTime )|...{....|
|000030d0| 4e 65 78 74 4e 65 74 55 | 70 64 61 74 65 54 69 6d |NextNetU|pdateTim|
|000030e0| 65 20 3d 20 4c 65 76 65 | 6c 2e 54 69 6d 65 53 65 |e = Leve|l.TimeSe|
|000030f0| 63 6f 6e 64 73 20 2b 20 | 4d 61 78 4e 65 74 55 70 |conds + |MaxNetUp|
|00003100| 64 61 74 65 49 6e 74 65 | 72 76 61 6c 3b 0d 0a 09 |dateInte|rval;...|
|00003110| 7d 0d 0a 09 65 6c 73 65 | 0d 0a 09 7b 0d 0a 09 09 |}...else|...{....|
|00003120| 72 65 74 75 72 6e 3b 0d | 0a 09 09 2f 2f 4e 65 78 |return;.|...//Nex|
|00003130| 74 4e 65 74 55 70 64 61 | 74 65 54 69 6d 65 20 3d |tNetUpda|teTime =|
|00003140| 20 4c 65 76 65 6c 2e 54 | 69 6d 65 53 65 63 6f 6e | Level.T|imeSecon|
|00003150| 64 73 20 2b 20 4d 61 78 | 4e 65 74 55 70 64 61 74 |ds + Max|NetUpdat|
|00003160| 65 49 6e 74 65 72 76 61 | 6c 3b 0d 0a 09 7d 0d 0a |eInterva|l;...}..|
|00003170| 0d 0a 09 43 61 72 53 74 | 61 74 65 2e 43 68 61 73 |...CarSt|ate.Chas|
|00003180| 73 69 73 50 6f 73 69 74 | 69 6f 6e 20 3d 20 43 75 |sisPosit|ion = Cu|
|00003190| 72 72 65 6e 74 43 68 61 | 73 73 69 73 53 74 61 74 |rrentCha|ssisStat|
|000031a0| 65 2e 50 6f 73 69 74 69 | 6f 6e 3b 0d 0a 09 43 61 |e.Positi|on;...Ca|
|000031b0| 72 53 74 61 74 65 2e 43 | 68 61 73 73 69 73 51 75 |rState.C|hassisQu|
|000031c0| 61 74 65 72 6e 69 6f 6e | 20 3d 20 43 75 72 72 65 |aternion| = Curre|
|000031d0| 6e 74 43 68 61 73 73 69 | 73 53 74 61 74 65 2e 51 |ntChassi|sState.Q|
|000031e0| 75 61 74 65 72 6e 69 6f | 6e 3b 0d 0a 09 43 61 72 |uaternio|n;...Car|
|000031f0| 53 74 61 74 65 2e 43 68 | 61 73 73 69 73 4c 69 6e |State.Ch|assisLin|
|00003200| 56 65 6c 20 3d 20 43 75 | 72 72 65 6e 74 43 68 61 |Vel = Cu|rrentCha|
|00003210| 73 73 69 73 53 74 61 74 | 65 2e 4c 69 6e 56 65 6c |ssisStat|e.LinVel|
|00003220| 3b 0d 0a 09 43 61 72 53 | 74 61 74 65 2e 43 68 61 |;...CarS|tate.Cha|
|00003230| 73 73 69 73 41 6e 67 56 | 65 6c 20 3d 20 43 75 72 |ssisAngV|el = Cur|
|00003240| 72 65 6e 74 43 68 61 73 | 73 69 73 53 74 61 74 65 |rentChas|sisState|
|00003250| 2e 41 6e 67 56 65 6c 3b | 0d 0a 0d 0a 0d 0a 09 43 |.AngVel;|.......C|
|00003260| 68 61 73 73 69 73 58 20 | 3d 20 51 75 61 74 52 6f |hassisX |= QuatRo|
|00003270| 74 61 74 65 56 65 63 74 | 6f 72 28 43 61 72 53 74 |tateVect|or(CarSt|
|00003280| 61 74 65 2e 43 68 61 73 | 73 69 73 51 75 61 74 65 |ate.Chas|sisQuate|
|00003290| 72 6e 69 6f 6e 2c 20 76 | 65 63 74 28 31 2c 20 30 |rnion, v|ect(1, 0|
|000032a0| 2c 20 30 29 29 3b 0d 0a | 09 43 68 61 73 73 69 73 |, 0));..|.Chassis|
|000032b0| 5a 20 3d 20 51 75 61 74 | 52 6f 74 61 74 65 56 65 |Z = Quat|RotateVe|
|000032c0| 63 74 6f 72 28 43 61 72 | 53 74 61 74 65 2e 43 68 |ctor(Car|State.Ch|
|000032d0| 61 73 73 69 73 51 75 61 | 74 65 72 6e 69 6f 6e 2c |assisQua|ternion,|
|000032e0| 20 76 65 63 74 28 30 2c | 20 30 2c 20 31 29 29 3b | vect(0,| 0, 1));|
|000032f0| 0d 0a 09 2f 2f 20 47 65 | 74 20 65 61 63 68 20 77 |...// Ge|t each w|
|00003300| 68 65 65 6c 20 73 74 61 | 74 65 2e 0d 0a 0d 0a 09 |heel sta|te......|
|00003310| 2f 2f 2f 2f 2f 2f 2f 2f | 2f 2f 2f 2f 2f 2f 2f 2f |////////|////////|
|00003320| 2f 2f 2f 2f 2f 2f 2f 2f | 2f 2f 20 46 52 4f 4e 54 |////////|// FRONT|
|00003330| 20 4c 45 46 54 20 2f 2f | 2f 2f 2f 2f 2f 2f 2f 2f | LEFT //|////////|
|00003340| 2f 2f 2f 2f 2f 2f 2f 2f | 2f 2f 2f 2f 2f 2f 2f 2f |////////|////////|
|00003350| 0d 0a 09 66 72 6f 6e 74 | 4c 65 66 74 2e 4b 47 65 |...front|Left.KGe|
|00003360| 74 52 69 67 69 64 42 6f | 64 79 53 74 61 74 65 28 |tRigidBo|dyState(|
|00003370| 57 68 65 65 6c 53 74 61 | 74 65 29 3b 0d 0a 09 77 |WheelSta|te);...w|
|00003380| 50 6f 73 20 3d 20 4b 52 | 42 56 65 63 54 6f 56 65 |Pos = KR|BVecToVe|
|00003390| 63 74 6f 72 28 57 68 65 | 65 6c 53 74 61 74 65 2e |ctor(Whe|elState.|
|000033a0| 50 6f 73 69 74 69 6f 6e | 29 3b 0d 0a 09 6c 50 6f |Position|);...lPo|
|000033b0| 73 20 3d 20 51 75 61 74 | 52 6f 74 61 74 65 56 65 |s = Quat|RotateVe|
|000033c0| 63 74 6f 72 28 51 75 61 | 74 49 6e 76 65 72 74 28 |ctor(Qua|tInvert(|
|000033d0| 43 61 72 53 74 61 74 65 | 2e 43 68 61 73 73 69 73 |CarState|.Chassis|
|000033e0| 51 75 61 74 65 72 6e 69 | 6f 6e 29 2c 20 77 50 6f |Quaterni|on), wPo|
|000033f0| 73 20 2d 20 63 68 61 73 | 73 69 73 50 6f 73 29 3b |s - chas|sisPos);|
|00003400| 20 2f 2f 20 43 6f 6e 76 | 65 72 74 20 66 72 6f 6d | // Conv|ert from|
|00003410| 20 77 6f 72 6c 64 20 74 | 6f 20 63 68 61 73 73 69 | world t|o chassi|
|00003420| 73 20 73 74 61 74 65 20 | 73 70 61 63 65 0d 0a 09 |s state |space...|
|00003430| 43 61 72 53 74 61 74 65 | 2e 57 68 65 65 6c 48 65 |CarState|.WheelHe|
|00003440| 69 67 68 74 5b 30 5d 20 | 3d 20 6c 50 6f 73 2e 5a |ight[0] |= lPos.Z|
|00003450| 3b 20 2f 2f 20 58 20 73 | 68 6f 75 6c 64 20 62 65 |; // X s|hould be|
|00003460| 20 57 68 65 65 6c 46 72 | 6f 6e 74 41 6c 6f 6e 67 | WheelFr|ontAlong|
|00003470| 2c 20 59 20 73 68 6f 75 | 6c 64 20 62 65 20 57 68 |, Y shou|ld be Wh|
|00003480| 65 65 6c 46 72 6f 6e 74 | 41 63 72 6f 73 73 0d 0a |eelFront|Across..|
|00003490| 0d 0a 09 2f 2f 20 46 6f | 72 20 66 72 6f 6e 74 20 |...// Fo|r front |
|000034a0| 77 68 65 65 6c 73 20 2d | 20 77 65 20 73 74 6f 72 |wheels -| we stor|
|000034b0| 65 20 74 68 65 69 72 20 | 63 75 72 72 65 6e 74 20 |e their |current |
|000034c0| 61 6e 67 6c 65 20 61 72 | 6f 75 6e 64 20 5a 20 61 |angle ar|ound Z a|
|000034d0| 73 20 77 65 6c 6c 2e 0d | 0a 09 57 68 65 65 6c 59 |s well..|..WheelY|
|000034e0| 20 3d 20 51 75 61 74 52 | 6f 74 61 74 65 56 65 63 | = QuatR|otateVec|
|000034f0| 74 6f 72 28 57 68 65 65 | 6c 53 74 61 74 65 2e 51 |tor(Whee|lState.Q|
|00003500| 75 61 74 65 72 6e 69 6f | 6e 2c 20 76 65 63 74 28 |uaternio|n, vect(|
|00003510| 30 2c 20 31 2c 20 30 29 | 29 3b 0d 0a 09 43 61 72 |0, 1, 0)|);...Car|
|00003520| 53 74 61 74 65 2e 46 72 | 6f 6e 74 57 68 65 65 6c |State.Fr|ontWheel|
|00003530| 41 6e 67 5b 30 5d 20 3d | 20 2d 41 53 69 6e 28 43 |Ang[0] =| -ASin(C|
|00003540| 68 61 73 73 69 73 58 20 | 44 6f 74 20 57 68 65 65 |hassisX |Dot Whee|
|00003550| 6c 59 29 3b 0d 0a 0d 0a | 09 2f 2f 20 46 69 6e 64 |lY);....|.// Find|
|00003560| 20 63 6f 6d 70 6f 6e 65 | 6e 74 20 6f 66 20 72 65 | compone|nt of re|
|00003570| 6c 61 74 69 76 65 20 77 | 68 65 65 6c 20 6c 69 6e |lative w|heel lin|
|00003580| 65 61 72 20 76 65 6c 6f | 63 69 74 79 20 61 6c 6f |ear velo|city alo|
|00003590| 6e 67 20 73 75 73 70 65 | 6e 73 69 6f 6e 20 74 72 |ng suspe|nsion tr|
|000035a0| 61 76 65 6c 20 28 63 68 | 61 73 73 69 73 5a 29 2e |avel (ch|assisZ).|
|000035b0| 0d 0a 09 77 50 6f 73 52 | 65 6c 20 3d 20 4b 52 42 |...wPosR|el = KRB|
|000035c0| 56 65 63 54 6f 56 65 63 | 74 6f 72 28 57 68 65 65 |VecToVec|tor(Whee|
|000035d0| 6c 53 74 61 74 65 2e 50 | 6f 73 69 74 69 6f 6e 29 |lState.P|osition)|
|000035e0| 20 2d 20 63 68 61 73 73 | 69 73 50 6f 73 3b 0d 0a | - chass|isPos;..|
|000035f0| 09 57 68 65 65 6c 4c 69 | 6e 56 65 6c 20 3d 20 63 |.WheelLi|nVel = c|
|00003600| 68 61 73 73 69 73 4c 69 | 6e 56 65 6c 20 2b 20 28 |hassisLi|nVel + (|
|00003610| 63 68 61 73 73 69 73 41 | 6e 67 56 65 6c 20 43 72 |chassisA|ngVel Cr|
|00003620| 6f 73 73 20 77 50 6f 73 | 52 65 6c 29 3b 0d 0a 0d |oss wPos|Rel);...|
|00003630| 0a 09 43 61 72 53 74 61 | 74 65 2e 57 68 65 65 6c |..CarSta|te.Wheel|
|00003640| 56 65 72 74 56 65 6c 5b | 30 5d 20 3d 20 0d 0a 09 |VertVel[|0] = ...|
|00003650| 09 28 28 57 68 65 65 6c | 53 74 61 74 65 2e 4c 69 |.((Wheel|State.Li|
|00003660| 6e 56 65 6c 2e 58 20 2d | 20 57 68 65 65 6c 4c 69 |nVel.X -| WheelLi|
|00003670| 6e 56 65 6c 2e 58 29 2a | 20 43 68 61 73 73 69 73 |nVel.X)*| Chassis|
|00003680| 5a 2e 58 29 20 2b 20 0d | 0a 09 09 28 28 57 68 65 |Z.X) + .|...((Whe|
|00003690| 65 6c 53 74 61 74 65 2e | 4c 69 6e 56 65 6c 2e 59 |elState.|LinVel.Y|
|000036a0| 20 2d 20 57 68 65 65 6c | 4c 69 6e 56 65 6c 2e 59 | - Wheel|LinVel.Y|
|000036b0| 29 2a 20 43 68 61 73 73 | 69 73 5a 2e 59 29 20 2b |)* Chass|isZ.Y) +|
|000036c0| 20 0d 0a 09 09 28 28 57 | 68 65 65 6c 53 74 61 74 | ....((W|heelStat|
|000036d0| 65 2e 4c 69 6e 56 65 6c | 2e 5a 20 2d 20 57 68 65 |e.LinVel|.Z - Whe|
|000036e0| 65 6c 4c 69 6e 56 65 6c | 2e 5a 29 2a 20 43 68 61 |elLinVel|.Z)* Cha|
|000036f0| 73 73 69 73 5a 2e 5a 29 | 3b 0d 0a 0d 0a 09 2f 2f |ssisZ.Z)|;.....//|
|00003700| 43 61 72 53 74 61 74 65 | 2e 57 68 65 65 6c 53 70 |CarState|.WheelSp|
|00003710| 69 6e 56 65 6c 5b 30 5d | 20 3d 20 4b 52 42 56 65 |inVel[0]| = KRBVe|
|00003720| 63 54 6f 56 65 63 74 6f | 72 28 57 68 65 65 6c 53 |cToVecto|r(WheelS|
|00003730| 74 61 74 65 2e 41 6e 67 | 56 65 6c 29 20 44 6f 74 |tate.Ang|Vel) Dot|
|00003740| 20 57 68 65 65 6c 59 3b | 0d 0a 0d 0a 09 2f 2f 2f | WheelY;|.....///|
|00003750| 2f 2f 2f 2f 2f 2f 2f 2f | 2f 2f 2f 2f 2f 2f 2f 2f |////////|////////|
|00003760| 2f 2f 2f 2f 2f 2f 2f 20 | 46 52 4f 4e 54 20 52 49 |/////// |FRONT RI|
|00003770| 47 48 54 20 2f 2f 2f 2f | 2f 2f 2f 2f 2f 2f 2f 2f |GHT ////|////////|
|00003780| 2f 2f 2f 2f 2f 2f 2f 2f | 2f 2f 2f 2f 2f 2f 0d 0a |////////|//////..|
|00003790| 09 66 72 6f 6e 74 52 69 | 67 68 74 2e 4b 47 65 74 |.frontRi|ght.KGet|
|000037a0| 52 69 67 69 64 42 6f 64 | 79 53 74 61 74 65 28 57 |RigidBod|yState(W|
|000037b0| 68 65 65 6c 53 74 61 74 | 65 29 3b 0d 0a 09 77 50 |heelStat|e);...wP|
|000037c0| 6f 73 20 3d 20 4b 52 42 | 56 65 63 54 6f 56 65 63 |os = KRB|VecToVec|
|000037d0| 74 6f 72 28 57 68 65 65 | 6c 53 74 61 74 65 2e 50 |tor(Whee|lState.P|
|000037e0| 6f 73 69 74 69 6f 6e 29 | 3b 0d 0a 09 6c 50 6f 73 |osition)|;...lPos|
|000037f0| 20 3d 20 51 75 61 74 52 | 6f 74 61 74 65 56 65 63 | = QuatR|otateVec|
|00003800| 74 6f 72 28 51 75 61 74 | 49 6e 76 65 72 74 28 43 |tor(Quat|Invert(C|
|00003810| 61 72 53 74 61 74 65 2e | 43 68 61 73 73 69 73 51 |arState.|ChassisQ|
|00003820| 75 61 74 65 72 6e 69 6f | 6e 29 2c 20 77 50 6f 73 |uaternio|n), wPos|
|00003830| 20 2d 20 63 68 61 73 73 | 69 73 50 6f 73 29 3b 0d | - chass|isPos);.|
|00003840| 0a 09 43 61 72 53 74 61 | 74 65 2e 57 68 65 65 6c |..CarSta|te.Wheel|
|00003850| 48 65 69 67 68 74 5b 31 | 5d 20 3d 20 6c 50 6f 73 |Height[1|] = lPos|
|00003860| 2e 5a 3b 0d 0a 0d 0a 09 | 57 68 65 65 6c 59 20 3d |.Z;.....|WheelY =|
|00003870| 20 51 75 61 74 52 6f 74 | 61 74 65 56 65 63 74 6f | QuatRot|ateVecto|
|00003880| 72 28 57 68 65 65 6c 53 | 74 61 74 65 2e 51 75 61 |r(WheelS|tate.Qua|
|00003890| 74 65 72 6e 69 6f 6e 2c | 20 76 65 63 74 28 30 2c |ternion,| vect(0,|
|000038a0| 20 31 2c 20 30 29 29 3b | 0d 0a 09 43 61 72 53 74 | 1, 0));|...CarSt|
|000038b0| 61 74 65 2e 46 72 6f 6e | 74 57 68 65 65 6c 41 6e |ate.Fron|tWheelAn|
|000038c0| 67 5b 31 5d 20 3d 20 2d | 41 53 69 6e 28 43 68 61 |g[1] = -|ASin(Cha|
|000038d0| 73 73 69 73 58 20 44 6f | 74 20 57 68 65 65 6c 59 |ssisX Do|t WheelY|
|000038e0| 29 3b 0d 0a 0d 0a 09 43 | 61 72 53 74 61 74 65 2e |);.....C|arState.|
|000038f0| 57 68 65 65 6c 56 65 72 | 74 56 65 6c 5b 31 5d 20 |WheelVer|tVel[1] |
|00003900| 3d 20 0d 0a 09 09 28 28 | 57 68 65 65 6c 53 74 61 |= ....((|WheelSta|
|00003910| 74 65 2e 4c 69 6e 56 65 | 6c 2e 58 20 2d 20 57 68 |te.LinVe|l.X - Wh|
|00003920| 65 65 6c 4c 69 6e 56 65 | 6c 2e 58 29 2a 20 43 68 |eelLinVe|l.X)* Ch|
|00003930| 61 73 73 69 73 5a 2e 58 | 29 20 2b 20 0d 0a 09 09 |assisZ.X|) + ....|
|00003940| 28 28 57 68 65 65 6c 53 | 74 61 74 65 2e 4c 69 6e |((WheelS|tate.Lin|
|00003950| 56 65 6c 2e 59 20 2d 20 | 57 68 65 65 6c 4c 69 6e |Vel.Y - |WheelLin|
|00003960| 56 65 6c 2e 59 29 2a 20 | 43 68 61 73 73 69 73 5a |Vel.Y)* |ChassisZ|
|00003970| 2e 59 29 20 2b 20 0d 0a | 09 09 28 28 57 68 65 65 |.Y) + ..|..((Whee|
|00003980| 6c 53 74 61 74 65 2e 4c | 69 6e 56 65 6c 2e 5a 20 |lState.L|inVel.Z |
|00003990| 2d 20 57 68 65 65 6c 4c | 69 6e 56 65 6c 2e 5a 29 |- WheelL|inVel.Z)|
|000039a0| 2a 20 43 68 61 73 73 69 | 73 5a 2e 5a 29 3b 0d 0a |* Chassi|sZ.Z);..|
|000039b0| 0d 0a 09 2f 2f 43 61 72 | 53 74 61 74 65 2e 57 68 |...//Car|State.Wh|
|000039c0| 65 65 6c 53 70 69 6e 56 | 65 6c 5b 31 5d 20 3d 20 |eelSpinV|el[1] = |
|000039d0| 4b 52 42 56 65 63 54 6f | 56 65 63 74 6f 72 28 57 |KRBVecTo|Vector(W|
|000039e0| 68 65 65 6c 53 74 61 74 | 65 2e 41 6e 67 56 65 6c |heelStat|e.AngVel|
|000039f0| 29 20 44 6f 74 20 57 68 | 65 65 6c 59 3b 0d 0a 0d |) Dot Wh|eelY;...|
|00003a00| 0a 09 2f 2f 2f 2f 2f 2f | 2f 2f 2f 2f 2f 2f 2f 2f |..//////|////////|
|00003a10| 2f 2f 2f 2f 2f 2f 2f 2f | 2f 2f 2f 2f 20 52 45 41 |////////|//// REA|
|00003a20| 52 20 4c 45 46 54 20 2f | 2f 2f 2f 2f 2f 2f 2f 2f |R LEFT /|////////|
|00003a30| 2f 2f 2f 2f 2f 2f 2f 2f | 2f 2f 2f 2f 2f 2f 2f 2f |////////|////////|
|00003a40| 2f 0d 0a 09 72 65 61 72 | 4c 65 66 74 2e 4b 47 65 |/...rear|Left.KGe|
|00003a50| 74 52 69 67 69 64 42 6f | 64 79 53 74 61 74 65 28 |tRigidBo|dyState(|
|00003a60| 57 68 65 65 6c 53 74 61 | 74 65 29 3b 0d 0a 09 77 |WheelSta|te);...w|
|00003a70| 50 6f 73 20 3d 20 4b 52 | 42 56 65 63 54 6f 56 65 |Pos = KR|BVecToVe|
|00003a80| 63 74 6f 72 28 57 68 65 | 65 6c 53 74 61 74 65 2e |ctor(Whe|elState.|
|00003a90| 50 6f 73 69 74 69 6f 6e | 29 3b 0d 0a 09 6c 50 6f |Position|);...lPo|
|00003aa0| 73 20 3d 20 51 75 61 74 | 52 6f 74 61 74 65 56 65 |s = Quat|RotateVe|
|00003ab0| 63 74 6f 72 28 51 75 61 | 74 49 6e 76 65 72 74 28 |ctor(Qua|tInvert(|
|00003ac0| 43 61 72 53 74 61 74 65 | 2e 43 68 61 73 73 69 73 |CarState|.Chassis|
|00003ad0| 51 75 61 74 65 72 6e 69 | 6f 6e 29 2c 20 77 50 6f |Quaterni|on), wPo|
|00003ae0| 73 20 2d 20 63 68 61 73 | 73 69 73 50 6f 73 29 3b |s - chas|sisPos);|
|00003af0| 0d 0a 09 43 61 72 53 74 | 61 74 65 2e 57 68 65 65 |...CarSt|ate.Whee|
|00003b00| 6c 48 65 69 67 68 74 5b | 32 5d 20 3d 20 6c 50 6f |lHeight[|2] = lPo|
|00003b10| 73 2e 5a 3b 0d 0a 0d 0a | 09 77 50 6f 73 52 65 6c |s.Z;....|.wPosRel|
|00003b20| 20 3d 20 4b 52 42 56 65 | 63 54 6f 56 65 63 74 6f | = KRBVe|cToVecto|
|00003b30| 72 28 57 68 65 65 6c 53 | 74 61 74 65 2e 50 6f 73 |r(WheelS|tate.Pos|
|00003b40| 69 74 69 6f 6e 29 20 2d | 20 63 68 61 73 73 69 73 |ition) -| chassis|
|00003b50| 50 6f 73 3b 0d 0a 09 57 | 68 65 65 6c 4c 69 6e 56 |Pos;...W|heelLinV|
|00003b60| 65 6c 20 3d 20 63 68 61 | 73 73 69 73 4c 69 6e 56 |el = cha|ssisLinV|
|00003b70| 65 6c 20 2b 20 28 63 68 | 61 73 73 69 73 41 6e 67 |el + (ch|assisAng|
|00003b80| 56 65 6c 20 43 72 6f 73 | 73 20 77 50 6f 73 52 65 |Vel Cros|s wPosRe|
|00003b90| 6c 29 3b 0d 0a 0d 0a 09 | 43 61 72 53 74 61 74 65 |l);.....|CarState|
|00003ba0| 2e 57 68 65 65 6c 56 65 | 72 74 56 65 6c 5b 32 5d |.WheelVe|rtVel[2]|
|00003bb0| 20 3d 20 0d 0a 09 09 28 | 28 57 68 65 65 6c 53 74 | = ....(|(WheelSt|
|00003bc0| 61 74 65 2e 4c 69 6e 56 | 65 6c 2e 58 20 2d 20 57 |ate.LinV|el.X - W|
|00003bd0| 68 65 65 6c 4c 69 6e 56 | 65 6c 2e 58 29 2a 20 43 |heelLinV|el.X)* C|
|00003be0| 68 61 73 73 69 73 5a 2e | 58 29 20 2b 20 0d 0a 09 |hassisZ.|X) + ...|
|00003bf0| 09 28 28 57 68 65 65 6c | 53 74 61 74 65 2e 4c 69 |.((Wheel|State.Li|
|00003c00| 6e 56 65 6c 2e 59 20 2d | 20 57 68 65 65 6c 4c 69 |nVel.Y -| WheelLi|
|00003c10| 6e 56 65 6c 2e 59 29 2a | 20 43 68 61 73 73 69 73 |nVel.Y)*| Chassis|
|00003c20| 5a 2e 59 29 20 2b 20 0d | 0a 09 09 28 28 57 68 65 |Z.Y) + .|...((Whe|
|00003c30| 65 6c 53 74 61 74 65 2e | 4c 69 6e 56 65 6c 2e 5a |elState.|LinVel.Z|
|00003c40| 20 2d 20 57 68 65 65 6c | 4c 69 6e 56 65 6c 2e 5a | - Wheel|LinVel.Z|
|00003c50| 29 2a 20 43 68 61 73 73 | 69 73 5a 2e 5a 29 3b 0d |)* Chass|isZ.Z);.|
|00003c60| 0a 0d 0a 09 57 68 65 65 | 6c 59 20 3d 20 51 75 61 |....Whee|lY = Qua|
|00003c70| 74 52 6f 74 61 74 65 56 | 65 63 74 6f 72 28 57 68 |tRotateV|ector(Wh|
|00003c80| 65 65 6c 53 74 61 74 65 | 2e 51 75 61 74 65 72 6e |eelState|.Quatern|
|00003c90| 69 6f 6e 2c 20 76 65 63 | 74 28 30 2c 20 31 2c 20 |ion, vec|t(0, 1, |
|00003ca0| 30 29 29 3b 0d 0a 09 2f | 2f 43 61 72 53 74 61 74 |0));.../|/CarStat|
|00003cb0| 65 2e 57 68 65 65 6c 53 | 70 69 6e 56 65 6c 5b 32 |e.WheelS|pinVel[2|
|00003cc0| 5d 20 3d 20 4b 52 42 56 | 65 63 54 6f 56 65 63 74 |] = KRBV|ecToVect|
|00003cd0| 6f 72 28 57 68 65 65 6c | 53 74 61 74 65 2e 41 6e |or(Wheel|State.An|
|00003ce0| 67 56 65 6c 29 20 44 6f | 74 20 57 68 65 65 6c 59 |gVel) Do|t WheelY|
|00003cf0| 3b 0d 0a 0d 0a 09 2f 2f | 2f 2f 2f 2f 2f 2f 2f 2f |;.....//|////////|
|00003d00| 2f 2f 2f 2f 2f 2f 2f 2f | 2f 2f 2f 2f 2f 2f 2f 2f |////////|////////|
|00003d10| 20 52 45 41 52 20 52 49 | 47 48 54 20 2f 2f 2f 2f | REAR RI|GHT ////|
|00003d20| 2f 2f 2f 2f 2f 2f 2f 2f | 2f 2f 2f 2f 2f 2f 2f 2f |////////|////////|
|00003d30| 2f 2f 2f 2f 2f 2f 0d 0a | 09 72 65 61 72 52 69 67 |//////..|.rearRig|
|00003d40| 68 74 2e 4b 47 65 74 52 | 69 67 69 64 42 6f 64 79 |ht.KGetR|igidBody|
|00003d50| 53 74 61 74 65 28 57 68 | 65 65 6c 53 74 61 74 65 |State(Wh|eelState|
|00003d60| 29 3b 0d 0a 09 77 50 6f | 73 20 3d 20 4b 52 42 56 |);...wPo|s = KRBV|
|00003d70| 65 63 54 6f 56 65 63 74 | 6f 72 28 57 68 65 65 6c |ecToVect|or(Wheel|
|00003d80| 53 74 61 74 65 2e 50 6f | 73 69 74 69 6f 6e 29 3b |State.Po|sition);|
|00003d90| 0d 0a 09 6c 50 6f 73 20 | 3d 20 51 75 61 74 52 6f |...lPos |= QuatRo|
|00003da0| 74 61 74 65 56 65 63 74 | 6f 72 28 51 75 61 74 49 |tateVect|or(QuatI|
|00003db0| 6e 76 65 72 74 28 43 61 | 72 53 74 61 74 65 2e 43 |nvert(Ca|rState.C|
|00003dc0| 68 61 73 73 69 73 51 75 | 61 74 65 72 6e 69 6f 6e |hassisQu|aternion|
|00003dd0| 29 2c 20 77 50 6f 73 20 | 2d 20 63 68 61 73 73 69 |), wPos |- chassi|
|00003de0| 73 50 6f 73 29 3b 0d 0a | 09 43 61 72 53 74 61 74 |sPos);..|.CarStat|
|00003df0| 65 2e 57 68 65 65 6c 48 | 65 69 67 68 74 5b 33 5d |e.WheelH|eight[3]|
|00003e00| 20 3d 20 6c 50 6f 73 2e | 5a 3b 0d 0a 0d 0a 09 77 | = lPos.|Z;.....w|
|00003e10| 50 6f 73 52 65 6c 20 3d | 20 4b 52 42 56 65 63 54 |PosRel =| KRBVecT|
|00003e20| 6f 56 65 63 74 6f 72 28 | 57 68 65 65 6c 53 74 61 |oVector(|WheelSta|
|00003e30| 74 65 2e 50 6f 73 69 74 | 69 6f 6e 29 20 2d 20 63 |te.Posit|ion) - c|
|00003e40| 68 61 73 73 69 73 50 6f | 73 3b 0d 0a 09 57 68 65 |hassisPo|s;...Whe|
|00003e50| 65 6c 4c 69 6e 56 65 6c | 20 3d 20 63 68 61 73 73 |elLinVel| = chass|
|00003e60| 69 73 4c 69 6e 56 65 6c | 20 2b 20 28 63 68 61 73 |isLinVel| + (chas|
|00003e70| 73 69 73 41 6e 67 56 65 | 6c 20 43 72 6f 73 73 20 |sisAngVe|l Cross |
|00003e80| 77 50 6f 73 52 65 6c 29 | 3b 0d 0a 0d 0a 09 43 61 |wPosRel)|;.....Ca|
|00003e90| 72 53 74 61 74 65 2e 57 | 68 65 65 6c 56 65 72 74 |rState.W|heelVert|
|00003ea0| 56 65 6c 5b 33 5d 20 3d | 20 0d 0a 09 09 28 28 57 |Vel[3] =| ....((W|
|00003eb0| 68 65 65 6c 53 74 61 74 | 65 2e 4c 69 6e 56 65 6c |heelStat|e.LinVel|
|00003ec0| 2e 58 20 2d 20 57 68 65 | 65 6c 4c 69 6e 56 65 6c |.X - Whe|elLinVel|
|00003ed0| 2e 58 29 2a 20 43 68 61 | 73 73 69 73 5a 2e 58 29 |.X)* Cha|ssisZ.X)|
|00003ee0| 20 2b 20 0d 0a 09 09 28 | 28 57 68 65 65 6c 53 74 | + ....(|(WheelSt|
|00003ef0| 61 74 65 2e 4c 69 6e 56 | 65 6c 2e 59 20 2d 20 57 |ate.LinV|el.Y - W|
|00003f00| 68 65 65 6c 4c 69 6e 56 | 65 6c 2e 59 29 2a 20 43 |heelLinV|el.Y)* C|
|00003f10| 68 61 73 73 69 73 5a 2e | 59 29 20 2b 20 0d 0a 09 |hassisZ.|Y) + ...|
|00003f20| 09 28 28 57 68 65 65 6c | 53 74 61 74 65 2e 4c 69 |.((Wheel|State.Li|
|00003f30| 6e 56 65 6c 2e 5a 20 2d | 20 57 68 65 65 6c 4c 69 |nVel.Z -| WheelLi|
|00003f40| 6e 56 65 6c 2e 5a 29 2a | 20 43 68 61 73 73 69 73 |nVel.Z)*| Chassis|
|00003f50| 5a 2e 5a 29 3b 0d 0a 0d | 0a 09 57 68 65 65 6c 59 |Z.Z);...|..WheelY|
|00003f60| 20 3d 20 51 75 61 74 52 | 6f 74 61 74 65 56 65 63 | = QuatR|otateVec|
|00003f70| 74 6f 72 28 57 68 65 65 | 6c 53 74 61 74 65 2e 51 |tor(Whee|lState.Q|
|00003f80| 75 61 74 65 72 6e 69 6f | 6e 2c 20 76 65 63 74 28 |uaternio|n, vect(|
|00003f90| 30 2c 20 31 2c 20 30 29 | 29 3b 0d 0a 09 2f 2f 43 |0, 1, 0)|);...//C|
|00003fa0| 61 72 53 74 61 74 65 2e | 57 68 65 65 6c 53 70 69 |arState.|WheelSpi|
|00003fb0| 6e 56 65 6c 5b 33 5d 20 | 3d 20 4b 52 42 56 65 63 |nVel[3] |= KRBVec|
|00003fc0| 54 6f 56 65 63 74 6f 72 | 28 57 68 65 65 6c 53 74 |ToVector|(WheelSt|
|00003fd0| 61 74 65 2e 41 6e 67 56 | 65 6c 29 20 44 6f 74 20 |ate.AngV|el) Dot |
|00003fe0| 57 68 65 65 6c 59 3b 0d | 0a 0d 0a 09 2f 2f 20 4f |WheelY;.|....// O|
|00003ff0| 54 48 45 52 0d 0a 09 43 | 61 72 53 74 61 74 65 2e |THER...C|arState.|
|00004000| 53 65 72 76 65 72 53 74 | 65 65 72 69 6e 67 20 3d |ServerSt|eering =|
|00004010| 20 53 74 65 65 72 69 6e | 67 3b 0d 0a 09 43 61 72 | Steerin|g;...Car|
|00004020| 53 74 61 74 65 2e 53 65 | 72 76 65 72 54 6f 72 71 |State.Se|rverTorq|
|00004030| 75 65 20 3d 20 4f 75 74 | 70 75 74 54 6f 72 71 75 |ue = Out|putTorqu|
|00004040| 65 3b 0d 0a 09 43 61 72 | 53 74 61 74 65 2e 53 65 |e;...Car|State.Se|
|00004050| 72 76 65 72 42 72 61 6b | 65 20 3d 20 4f 75 74 70 |rverBrak|e = Outp|
|00004060| 75 74 42 72 61 6b 65 3b | 0d 0a 09 43 61 72 53 74 |utBrake;|...CarSt|
|00004070| 61 74 65 2e 53 65 72 76 | 65 72 48 61 6e 64 62 72 |ate.Serv|erHandbr|
|00004080| 61 6b 65 4f 6e 20 3d 20 | 4f 75 74 70 75 74 48 61 |akeOn = |OutputHa|
|00004090| 6e 64 62 72 61 6b 65 4f | 6e 3b 0d 0a 0d 0a 09 2f |ndbrakeO|n;...../|
|000040a0| 2f 20 54 68 69 73 20 66 | 6c 61 67 20 6c 65 74 73 |/ This f|lag lets|
|000040b0| 20 74 68 65 20 63 6c 69 | 65 6e 74 20 6b 6e 6f 77 | the cli|ent know|
|000040c0| 20 74 68 69 73 20 64 61 | 74 61 20 69 73 20 6e 65 | this da|ta is ne|
|000040d0| 77 2e 0d 0a 09 43 61 72 | 53 74 61 74 65 2e 62 4e |w....Car|State.bN|
|000040e0| 65 77 53 74 61 74 65 20 | 3d 20 74 72 75 65 3b 0d |ewState |= true;.|
|000040f0| 0a 7d 0d 0a 0d 0a 73 69 | 6d 75 6c 61 74 65 64 20 |.}....si|mulated |
|00004100| 66 75 6e 63 74 69 6f 6e | 20 50 6f 73 74 4e 65 74 |function| PostNet|
|00004110| 42 65 67 69 6e 50 6c 61 | 79 28 29 0d 0a 7b 0d 0a |BeginPla|y()..{..|
|00004120| 09 6c 6f 63 61 6c 20 76 | 65 63 74 6f 72 20 52 6f |.local v|ector Ro|
|00004130| 74 58 2c 20 52 6f 74 59 | 2c 20 52 6f 74 5a 2c 20 |tX, RotY|, RotZ, |
|00004140| 6c 50 6f 73 3b 0d 0a 0d | 0a 20 20 20 20 53 75 70 |lPos;...|. Sup|
|00004150| 65 72 2e 50 6f 73 74 4e | 65 74 42 65 67 69 6e 50 |er.PostN|etBeginP|
|00004160| 6c 61 79 28 29 3b 0d 0a | 0d 0a 20 20 20 20 2f 2f |lay();..|.. //|
|00004170| 20 53 65 74 20 75 70 20 | 73 75 73 70 65 6e 73 69 | Set up |suspensi|
|00004180| 6f 6e 20 67 72 61 70 68 | 69 63 73 0d 0a 0d 0a 20 |on graph|ics.... |
|00004190| 20 20 20 47 65 74 41 78 | 65 73 28 52 6f 74 61 74 | GetAx|es(Rotat|
|000041a0| 69 6f 6e 2c 52 6f 74 58 | 2c 52 6f 74 59 2c 52 6f |ion,RotX|,RotY,Ro|
|000041b0| 74 5a 29 3b 0d 0a 0d 0a | 20 20 20 20 2f 2f 20 53 |tZ);....| // S|
|000041c0| 70 61 77 6e 20 77 68 65 | 65 6c 73 2c 20 61 6e 64 |pawn whe|els, and|
|000041d0| 20 66 6c 69 70 20 67 72 | 61 70 68 69 63 73 20 77 | flip gr|aphics w|
|000041e0| 68 65 72 65 20 6e 65 63 | 65 73 73 61 72 79 0d 0a |here nec|essary..|
|000041f0| 20 20 20 20 66 72 6f 6e | 74 4c 65 66 74 20 3d 20 | fron|tLeft = |
|00004200| 73 70 61 77 6e 28 46 72 | 6f 6e 74 54 69 72 65 43 |spawn(Fr|ontTireC|
|00004210| 6c 61 73 73 2c 20 73 65 | 6c 66 2c 2c 20 4c 6f 63 |lass, se|lf,, Loc|
|00004220| 61 74 69 6f 6e 20 2b 20 | 57 68 65 65 6c 46 72 6f |ation + |WheelFro|
|00004230| 6e 74 41 6c 6f 6e 67 2a | 52 6f 74 58 20 2b 20 57 |ntAlong*|RotX + W|
|00004240| 68 65 65 6c 46 72 6f 6e | 74 41 63 72 6f 73 73 2a |heelFron|tAcross*|
|00004250| 52 6f 74 59 20 2b 20 57 | 68 65 65 6c 56 65 72 74 |RotY + W|heelVert|
|00004260| 2a 52 6f 74 5a 2c 20 52 | 6f 74 61 74 69 6f 6e 29 |*RotZ, R|otation)|
|00004270| 3b 0d 0a 20 20 20 20 2f | 2f 66 72 6f 6e 74 4c 65 |;.. /|/frontLe|
|00004280| 66 74 2e 53 65 74 44 72 | 61 77 53 63 61 6c 65 28 |ft.SetDr|awScale(|
|00004290| 31 29 3b 0d 0a 20 20 20 | 20 66 72 6f 6e 74 4c 65 |1);.. | frontLe|
|000042a0| 66 74 2e 53 65 74 44 72 | 61 77 53 63 61 6c 65 33 |ft.SetDr|awScale3|
|000042b0| 44 28 76 65 63 74 28 31 | 2c 20 31 2c 20 31 29 29 |D(vect(1|, 1, 1))|
|000042c0| 3b 0d 0a 0d 0a 20 20 20 | 20 66 72 6f 6e 74 52 69 |;.... | frontRi|
|000042d0| 67 68 74 20 3d 20 73 70 | 61 77 6e 28 46 72 6f 6e |ght = sp|awn(Fron|
|000042e0| 74 54 69 72 65 43 6c 61 | 73 73 2c 20 73 65 6c 66 |tTireCla|ss, self|
|000042f0| 2c 2c 20 4c 6f 63 61 74 | 69 6f 6e 20 2b 20 57 68 |,, Locat|ion + Wh|
|00004300| 65 65 6c 46 72 6f 6e 74 | 41 6c 6f 6e 67 2a 52 6f |eelFront|Along*Ro|
|00004310| 74 58 20 2d 20 57 68 65 | 65 6c 46 72 6f 6e 74 41 |tX - Whe|elFrontA|
|00004320| 63 72 6f 73 73 2a 52 6f | 74 59 20 2b 20 57 68 65 |cross*Ro|tY + Whe|
|00004330| 65 6c 56 65 72 74 2a 52 | 6f 74 5a 2c 20 52 6f 74 |elVert*R|otZ, Rot|
|00004340| 61 74 69 6f 6e 29 3b 0d | 0a 20 20 20 20 66 72 6f |ation);.|. fro|
|00004350| 6e 74 52 69 67 68 74 2e | 53 65 74 44 72 61 77 53 |ntRight.|SetDrawS|
|00004360| 63 61 6c 65 33 44 28 76 | 65 63 74 28 31 2c 20 2d |cale3D(v|ect(1, -|
|00004370| 31 2c 20 31 29 29 3b 0d | 0a 0d 0a 20 20 20 20 72 |1, 1));.|... r|
|00004380| 65 61 72 4c 65 66 74 20 | 3d 20 73 70 61 77 6e 28 |earLeft |= spawn(|
|00004390| 52 65 61 72 54 69 72 65 | 43 6c 61 73 73 2c 20 73 |RearTire|Class, s|
|000043a0| 65 6c 66 2c 2c 20 4c 6f | 63 61 74 69 6f 6e 20 2b |elf,, Lo|cation +|
|000043b0| 20 57 68 65 65 6c 52 65 | 61 72 41 6c 6f 6e 67 2a | WheelRe|arAlong*|
|000043c0| 52 6f 74 58 20 2b 20 57 | 68 65 65 6c 52 65 61 72 |RotX + W|heelRear|
|000043d0| 41 63 72 6f 73 73 2a 52 | 6f 74 59 20 2b 20 57 68 |Across*R|otY + Wh|
|000043e0| 65 65 6c 56 65 72 74 2a | 52 6f 74 5a 2c 20 52 6f |eelVert*|RotZ, Ro|
|000043f0| 74 61 74 69 6f 6e 29 3b | 0d 0a 20 20 20 20 2f 2f |tation);|.. //|
|00004400| 72 65 61 72 4c 65 66 74 | 2e 53 65 74 44 72 61 77 |rearLeft|.SetDraw|
|00004410| 53 63 61 6c 65 28 31 29 | 3b 0d 0a 20 20 20 20 72 |Scale(1)|;.. r|
|00004420| 65 61 72 4c 65 66 74 2e | 53 65 74 44 72 61 77 53 |earLeft.|SetDrawS|
|00004430| 63 61 6c 65 33 44 28 76 | 65 63 74 28 31 2c 20 31 |cale3D(v|ect(1, 1|
|00004440| 2c 20 31 29 29 3b 0d 0a | 0d 0a 20 20 20 20 72 65 |, 1));..|.. re|
|00004450| 61 72 52 69 67 68 74 20 | 3d 20 73 70 61 77 6e 28 |arRight |= spawn(|
|00004460| 52 65 61 72 54 69 72 65 | 43 6c 61 73 73 2c 20 73 |RearTire|Class, s|
|00004470| 65 6c 66 2c 2c 20 4c 6f | 63 61 74 69 6f 6e 20 2b |elf,, Lo|cation +|
|00004480| 20 57 68 65 65 6c 52 65 | 61 72 41 6c 6f 6e 67 2a | WheelRe|arAlong*|
|00004490| 52 6f 74 58 20 2d 20 57 | 68 65 65 6c 52 65 61 72 |RotX - W|heelRear|
|000044a0| 41 63 72 6f 73 73 2a 52 | 6f 74 59 20 2b 20 57 68 |Across*R|otY + Wh|
|000044b0| 65 65 6c 56 65 72 74 2a | 52 6f 74 5a 2c 20 52 6f |eelVert*|RotZ, Ro|
|000044c0| 74 61 74 69 6f 6e 29 3b | 0d 0a 20 20 20 20 72 65 |tation);|.. re|
|000044d0| 61 72 52 69 67 68 74 2e | 53 65 74 44 72 61 77 53 |arRight.|SetDrawS|
|000044e0| 63 61 6c 65 33 44 28 76 | 65 63 74 28 31 2c 20 2d |cale3D(v|ect(1, -|
|000044f0| 31 2c 20 31 29 29 3b 0d | 0a 0d 0a 20 20 20 20 2f |1, 1));.|... /|
|00004500| 2f 20 43 72 65 61 74 65 | 20 6a 6f 69 6e 74 73 0d |/ Create| joints.|
|00004510| 0a 09 6c 50 6f 73 2e 58 | 20 3d 20 57 68 65 65 6c |..lPos.X| = Wheel|
|00004520| 46 72 6f 6e 74 41 6c 6f | 6e 67 3b 0d 0a 09 6c 50 |FrontAlo|ng;...lP|
|00004530| 6f 73 2e 59 20 3d 20 57 | 68 65 65 6c 46 72 6f 6e |os.Y = W|heelFron|
|00004540| 74 41 63 72 6f 73 73 3b | 0d 0a 09 6c 50 6f 73 2e |tAcross;|...lPos.|
|00004550| 5a 20 3d 20 57 68 65 65 | 6c 56 65 72 74 3b 0d 0a |Z = Whee|lVert;..|
|00004560| 20 20 20 20 66 72 6f 6e | 74 4c 65 66 74 2e 57 68 | fron|tLeft.Wh|
|00004570| 65 65 6c 4a 6f 69 6e 74 | 20 3d 20 73 70 61 77 6e |eelJoint| = spawn|
|00004580| 28 63 6c 61 73 73 27 4b | 43 61 72 57 68 65 65 6c |(class'K|CarWheel|
|00004590| 4a 6f 69 6e 74 27 2c 20 | 73 65 6c 66 29 3b 0d 0a |Joint', |self);..|
|000045a0| 20 20 20 20 66 72 6f 6e | 74 4c 65 66 74 2e 57 68 | fron|tLeft.Wh|
|000045b0| 65 65 6c 4a 6f 69 6e 74 | 2e 4b 50 6f 73 31 20 3d |eelJoint|.KPos1 =|
|000045c0| 20 6c 50 6f 73 2f 35 30 | 3b 0d 0a 20 20 20 20 66 | lPos/50|;.. f|
|000045d0| 72 6f 6e 74 4c 65 66 74 | 2e 57 68 65 65 6c 4a 6f |rontLeft|.WheelJo|
|000045e0| 69 6e 74 2e 4b 50 72 69 | 41 78 69 73 31 20 3d 20 |int.KPri|Axis1 = |
|000045f0| 76 65 63 74 28 30 2c 20 | 30 2c 20 31 29 3b 0d 0a |vect(0, |0, 1);..|
|00004600| 20 20 20 20 66 72 6f 6e | 74 4c 65 66 74 2e 57 68 | fron|tLeft.Wh|
|00004610| 65 65 6c 4a 6f 69 6e 74 | 2e 4b 53 65 63 41 78 69 |eelJoint|.KSecAxi|
|00004620| 73 31 20 3d 20 76 65 63 | 74 28 30 2c 20 31 2c 20 |s1 = vec|t(0, 1, |
|00004630| 30 29 3b 0d 0a 20 20 20 | 20 66 72 6f 6e 74 4c 65 |0);.. | frontLe|
|00004640| 66 74 2e 57 68 65 65 6c | 4a 6f 69 6e 74 2e 4b 43 |ft.Wheel|Joint.KC|
|00004650| 6f 6e 73 74 72 61 69 6e | 74 41 63 74 6f 72 31 20 |onstrain|tActor1 |
|00004660| 3d 20 73 65 6c 66 3b 0d | 0a 20 20 20 20 66 72 6f |= self;.|. fro|
|00004670| 6e 74 4c 65 66 74 2e 57 | 68 65 65 6c 4a 6f 69 6e |ntLeft.W|heelJoin|
|00004680| 74 2e 4b 50 6f 73 32 20 | 3d 20 76 65 63 74 28 30 |t.KPos2 |= vect(0|
|00004690| 2c 20 30 2c 20 30 29 3b | 0d 0a 20 20 20 20 66 72 |, 0, 0);|.. fr|
|000046a0| 6f 6e 74 4c 65 66 74 2e | 57 68 65 65 6c 4a 6f 69 |ontLeft.|WheelJoi|
|000046b0| 6e 74 2e 4b 50 72 69 41 | 78 69 73 32 20 3d 20 76 |nt.KPriA|xis2 = v|
|000046c0| 65 63 74 28 30 2c 20 30 | 2c 20 31 29 3b 0d 0a 20 |ect(0, 0|, 1);.. |
|000046d0| 20 20 20 66 72 6f 6e 74 | 4c 65 66 74 2e 57 68 65 | front|Left.Whe|
|000046e0| 65 6c 4a 6f 69 6e 74 2e | 4b 53 65 63 41 78 69 73 |elJoint.|KSecAxis|
|000046f0| 32 20 3d 20 76 65 63 74 | 28 30 2c 20 31 2c 20 30 |2 = vect|(0, 1, 0|
|00004700| 29 3b 0d 0a 20 20 20 20 | 66 72 6f 6e 74 4c 65 66 |);.. |frontLef|
|00004710| 74 2e 57 68 65 65 6c 4a | 6f 69 6e 74 2e 4b 43 6f |t.WheelJ|oint.KCo|
|00004720| 6e 73 74 72 61 69 6e 74 | 41 63 74 6f 72 32 20 3d |nstraint|Actor2 =|
|00004730| 20 66 72 6f 6e 74 4c 65 | 66 74 3b 0d 0a 20 20 20 | frontLe|ft;.. |
|00004740| 20 66 72 6f 6e 74 4c 65 | 66 74 2e 57 68 65 65 6c | frontLe|ft.Wheel|
|00004750| 4a 6f 69 6e 74 2e 53 65 | 74 50 68 79 73 69 63 73 |Joint.Se|tPhysics|
|00004760| 28 50 48 59 53 5f 4b 61 | 72 6d 61 29 3b 0d 0a 0d |(PHYS_Ka|rma);...|
|00004770| 0a 09 6c 50 6f 73 2e 59 | 20 3d 20 2d 57 68 65 65 |..lPos.Y| = -Whee|
|00004780| 6c 46 72 6f 6e 74 41 63 | 72 6f 73 73 3b 0d 0a 20 |lFrontAc|ross;.. |
|00004790| 20 20 20 66 72 6f 6e 74 | 52 69 67 68 74 2e 57 68 | front|Right.Wh|
|000047a0| 65 65 6c 4a 6f 69 6e 74 | 20 3d 20 73 70 61 77 6e |eelJoint| = spawn|
|000047b0| 28 63 6c 61 73 73 27 4b | 43 61 72 57 68 65 65 6c |(class'K|CarWheel|
|000047c0| 4a 6f 69 6e 74 27 2c 20 | 73 65 6c 66 29 3b 0d 0a |Joint', |self);..|
|000047d0| 20 20 20 20 66 72 6f 6e | 74 52 69 67 68 74 2e 57 | fron|tRight.W|
|000047e0| 68 65 65 6c 4a 6f 69 6e | 74 2e 4b 50 6f 73 31 20 |heelJoin|t.KPos1 |
|000047f0| 3d 20 6c 50 6f 73 2f 35 | 30 3b 0d 0a 20 20 20 20 |= lPos/5|0;.. |
|00004800| 66 72 6f 6e 74 52 69 67 | 68 74 2e 57 68 65 65 6c |frontRig|ht.Wheel|
|00004810| 4a 6f 69 6e 74 2e 4b 50 | 72 69 41 78 69 73 31 20 |Joint.KP|riAxis1 |
|00004820| 3d 20 76 65 63 74 28 30 | 2c 20 30 2c 20 31 29 3b |= vect(0|, 0, 1);|
|00004830| 0d 0a 20 20 20 20 66 72 | 6f 6e 74 52 69 67 68 74 |.. fr|ontRight|
|00004840| 2e 57 68 65 65 6c 4a 6f | 69 6e 74 2e 4b 53 65 63 |.WheelJo|int.KSec|
|00004850| 41 78 69 73 31 20 3d 20 | 76 65 63 74 28 30 2c 20 |Axis1 = |vect(0, |
|00004860| 31 2c 20 30 29 3b 0d 0a | 20 20 20 20 66 72 6f 6e |1, 0);..| fron|
|00004870| 74 52 69 67 68 74 2e 57 | 68 65 65 6c 4a 6f 69 6e |tRight.W|heelJoin|
|00004880| 74 2e 4b 43 6f 6e 73 74 | 72 61 69 6e 74 41 63 74 |t.KConst|raintAct|
|00004890| 6f 72 31 20 3d 20 73 65 | 6c 66 3b 0d 0a 20 20 20 |or1 = se|lf;.. |
|000048a0| 20 66 72 6f 6e 74 52 69 | 67 68 74 2e 57 68 65 65 | frontRi|ght.Whee|
|000048b0| 6c 4a 6f 69 6e 74 2e 4b | 50 6f 73 32 20 3d 20 76 |lJoint.K|Pos2 = v|
|000048c0| 65 63 74 28 30 2c 20 30 | 2c 20 30 29 3b 0d 0a 20 |ect(0, 0|, 0);.. |
|000048d0| 20 20 20 66 72 6f 6e 74 | 52 69 67 68 74 2e 57 68 | front|Right.Wh|
|000048e0| 65 65 6c 4a 6f 69 6e 74 | 2e 4b 50 72 69 41 78 69 |eelJoint|.KPriAxi|
|000048f0| 73 32 20 3d 20 76 65 63 | 74 28 30 2c 20 30 2c 20 |s2 = vec|t(0, 0, |
|00004900| 31 29 3b 0d 0a 20 20 20 | 20 66 72 6f 6e 74 52 69 |1);.. | frontRi|
|00004910| 67 68 74 2e 57 68 65 65 | 6c 4a 6f 69 6e 74 2e 4b |ght.Whee|lJoint.K|
|00004920| 53 65 63 41 78 69 73 32 | 20 3d 20 76 65 63 74 28 |SecAxis2| = vect(|
|00004930| 30 2c 20 31 2c 20 30 29 | 3b 0d 0a 20 20 20 20 66 |0, 1, 0)|;.. f|
|00004940| 72 6f 6e 74 52 69 67 68 | 74 2e 57 68 65 65 6c 4a |rontRigh|t.WheelJ|
|00004950| 6f 69 6e 74 2e 4b 43 6f | 6e 73 74 72 61 69 6e 74 |oint.KCo|nstraint|
|00004960| 41 63 74 6f 72 32 20 3d | 20 66 72 6f 6e 74 52 69 |Actor2 =| frontRi|
|00004970| 67 68 74 3b 0d 0a 20 20 | 20 20 66 72 6f 6e 74 52 |ght;.. | frontR|
|00004980| 69 67 68 74 2e 57 68 65 | 65 6c 4a 6f 69 6e 74 2e |ight.Whe|elJoint.|
|00004990| 53 65 74 50 68 79 73 69 | 63 73 28 50 48 59 53 5f |SetPhysi|cs(PHYS_|
|000049a0| 4b 61 72 6d 61 29 3b 0d | 0a 0d 0a 09 6c 50 6f 73 |Karma);.|....lPos|
|000049b0| 2e 58 20 3d 20 57 68 65 | 65 6c 52 65 61 72 41 6c |.X = Whe|elRearAl|
|000049c0| 6f 6e 67 3b 0d 0a 09 6c | 50 6f 73 2e 59 20 3d 20 |ong;...l|Pos.Y = |
|000049d0| 57 68 65 65 6c 52 65 61 | 72 41 63 72 6f 73 73 3b |WheelRea|rAcross;|
|000049e0| 0d 0a 20 20 20 20 72 65 | 61 72 4c 65 66 74 2e 57 |.. re|arLeft.W|
|000049f0| 68 65 65 6c 4a 6f 69 6e | 74 20 3d 20 73 70 61 77 |heelJoin|t = spaw|
|00004a00| 6e 28 63 6c 61 73 73 27 | 4b 43 61 72 57 68 65 65 |n(class'|KCarWhee|
|00004a10| 6c 4a 6f 69 6e 74 27 2c | 20 73 65 6c 66 29 3b 0d |lJoint',| self);.|
|00004a20| 0a 20 20 20 20 72 65 61 | 72 4c 65 66 74 2e 57 68 |. rea|rLeft.Wh|
|00004a30| 65 65 6c 4a 6f 69 6e 74 | 2e 4b 50 6f 73 31 20 3d |eelJoint|.KPos1 =|
|00004a40| 20 6c 50 6f 73 2f 35 30 | 3b 0d 0a 20 20 20 20 72 | lPos/50|;.. r|
|00004a50| 65 61 72 4c 65 66 74 2e | 57 68 65 65 6c 4a 6f 69 |earLeft.|WheelJoi|
|00004a60| 6e 74 2e 4b 50 72 69 41 | 78 69 73 31 20 3d 20 76 |nt.KPriA|xis1 = v|
|00004a70| 65 63 74 28 30 2c 20 30 | 2c 20 31 29 3b 0d 0a 20 |ect(0, 0|, 1);.. |
|00004a80| 20 20 20 72 65 61 72 4c | 65 66 74 2e 57 68 65 65 | rearL|eft.Whee|
|00004a90| 6c 4a 6f 69 6e 74 2e 4b | 53 65 63 41 78 69 73 31 |lJoint.K|SecAxis1|
|00004aa0| 20 3d 20 76 65 63 74 28 | 30 2c 20 31 2c 20 30 29 | = vect(|0, 1, 0)|
|00004ab0| 3b 0d 0a 20 20 20 20 72 | 65 61 72 4c 65 66 74 2e |;.. r|earLeft.|
|00004ac0| 57 68 65 65 6c 4a 6f 69 | 6e 74 2e 4b 43 6f 6e 73 |WheelJoi|nt.KCons|
|00004ad0| 74 72 61 69 6e 74 41 63 | 74 6f 72 31 20 3d 20 73 |traintAc|tor1 = s|
|00004ae0| 65 6c 66 3b 0d 0a 20 20 | 20 20 72 65 61 72 4c 65 |elf;.. | rearLe|
|00004af0| 66 74 2e 57 68 65 65 6c | 4a 6f 69 6e 74 2e 4b 50 |ft.Wheel|Joint.KP|
|00004b00| 6f 73 32 20 3d 20 76 65 | 63 74 28 30 2c 20 30 2c |os2 = ve|ct(0, 0,|
|00004b10| 20 30 29 3b 0d 0a 20 20 | 20 20 72 65 61 72 4c 65 | 0);.. | rearLe|
|00004b20| 66 74 2e 57 68 65 65 6c | 4a 6f 69 6e 74 2e 4b 50 |ft.Wheel|Joint.KP|
|00004b30| 72 69 41 78 69 73 32 20 | 3d 20 76 65 63 74 28 30 |riAxis2 |= vect(0|
|00004b40| 2c 20 30 2c 20 31 29 3b | 0d 0a 20 20 20 20 72 65 |, 0, 1);|.. re|
|00004b50| 61 72 4c 65 66 74 2e 57 | 68 65 65 6c 4a 6f 69 6e |arLeft.W|heelJoin|
|00004b60| 74 2e 4b 53 65 63 41 78 | 69 73 32 20 3d 20 76 65 |t.KSecAx|is2 = ve|
|00004b70| 63 74 28 30 2c 20 31 2c | 20 30 29 3b 0d 0a 20 20 |ct(0, 1,| 0);.. |
|00004b80| 20 20 72 65 61 72 4c 65 | 66 74 2e 57 68 65 65 6c | rearLe|ft.Wheel|
|00004b90| 4a 6f 69 6e 74 2e 4b 43 | 6f 6e 73 74 72 61 69 6e |Joint.KC|onstrain|
|00004ba0| 74 41 63 74 6f 72 32 20 | 3d 20 72 65 61 72 4c 65 |tActor2 |= rearLe|
|00004bb0| 66 74 3b 0d 0a 20 20 20 | 20 72 65 61 72 4c 65 66 |ft;.. | rearLef|
|00004bc0| 74 2e 57 68 65 65 6c 4a | 6f 69 6e 74 2e 53 65 74 |t.WheelJ|oint.Set|
|00004bd0| 50 68 79 73 69 63 73 28 | 50 48 59 53 5f 4b 61 72 |Physics(|PHYS_Kar|
|00004be0| 6d 61 29 3b 0d 0a 0d 0a | 20 20 20 20 6c 50 6f 73 |ma);....| lPos|
|00004bf0| 2e 59 20 3d 20 2d 57 68 | 65 65 6c 52 65 61 72 41 |.Y = -Wh|eelRearA|
|00004c00| 63 72 6f 73 73 3b 0d 0a | 09 72 65 61 72 52 69 67 |cross;..|.rearRig|
|00004c10| 68 74 2e 57 68 65 65 6c | 4a 6f 69 6e 74 20 3d 20 |ht.Wheel|Joint = |
|00004c20| 73 70 61 77 6e 28 63 6c | 61 73 73 27 4b 43 61 72 |spawn(cl|ass'KCar|
|00004c30| 57 68 65 65 6c 4a 6f 69 | 6e 74 27 2c 20 73 65 6c |WheelJoi|nt', sel|
|00004c40| 66 29 3b 0d 0a 20 20 20 | 20 72 65 61 72 52 69 67 |f);.. | rearRig|
|00004c50| 68 74 2e 57 68 65 65 6c | 4a 6f 69 6e 74 2e 4b 50 |ht.Wheel|Joint.KP|
|00004c60| 6f 73 31 20 3d 20 6c 50 | 6f 73 2f 35 30 3b 0d 0a |os1 = lP|os/50;..|
|00004c70| 20 20 20 20 72 65 61 72 | 52 69 67 68 74 2e 57 68 | rear|Right.Wh|
|00004c80| 65 65 6c 4a 6f 69 6e 74 | 2e 4b 50 72 69 41 78 69 |eelJoint|.KPriAxi|
|00004c90| 73 31 20 3d 20 76 65 63 | 74 28 30 2c 20 30 2c 20 |s1 = vec|t(0, 0, |
|00004ca0| 31 29 3b 0d 0a 20 20 20 | 20 72 65 61 72 52 69 67 |1);.. | rearRig|
|00004cb0| 68 74 2e 57 68 65 65 6c | 4a 6f 69 6e 74 2e 4b 53 |ht.Wheel|Joint.KS|
|00004cc0| 65 63 41 78 69 73 31 20 | 3d 20 76 65 63 74 28 30 |ecAxis1 |= vect(0|
|00004cd0| 2c 20 31 2c 20 30 29 3b | 0d 0a 20 20 20 20 72 65 |, 1, 0);|.. re|
|00004ce0| 61 72 52 69 67 68 74 2e | 57 68 65 65 6c 4a 6f 69 |arRight.|WheelJoi|
|00004cf0| 6e 74 2e 4b 43 6f 6e 73 | 74 72 61 69 6e 74 41 63 |nt.KCons|traintAc|
|00004d00| 74 6f 72 31 20 3d 20 73 | 65 6c 66 3b 0d 0a 20 20 |tor1 = s|elf;.. |
|00004d10| 20 20 72 65 61 72 52 69 | 67 68 74 2e 57 68 65 65 | rearRi|ght.Whee|
|00004d20| 6c 4a 6f 69 6e 74 2e 4b | 50 6f 73 32 20 3d 20 76 |lJoint.K|Pos2 = v|
|00004d30| 65 63 74 28 30 2c 20 30 | 2c 20 30 29 3b 0d 0a 20 |ect(0, 0|, 0);.. |
|00004d40| 20 20 20 72 65 61 72 52 | 69 67 68 74 2e 57 68 65 | rearR|ight.Whe|
|00004d50| 65 6c 4a 6f 69 6e 74 2e | 4b 50 72 69 41 78 69 73 |elJoint.|KPriAxis|
|00004d60| 32 20 3d 20 76 65 63 74 | 28 30 2c 20 30 2c 20 31 |2 = vect|(0, 0, 1|
|00004d70| 29 3b 0d 0a 20 20 20 20 | 72 65 61 72 52 69 67 68 |);.. |rearRigh|
|00004d80| 74 2e 57 68 65 65 6c 4a | 6f 69 6e 74 2e 4b 53 65 |t.WheelJ|oint.KSe|
|00004d90| 63 41 78 69 73 32 20 3d | 20 76 65 63 74 28 30 2c |cAxis2 =| vect(0,|
|00004da0| 20 31 2c 20 30 29 3b 0d | 0a 20 20 20 20 72 65 61 | 1, 0);.|. rea|
|00004db0| 72 52 69 67 68 74 2e 57 | 68 65 65 6c 4a 6f 69 6e |rRight.W|heelJoin|
|00004dc0| 74 2e 4b 43 6f 6e 73 74 | 72 61 69 6e 74 41 63 74 |t.KConst|raintAct|
|00004dd0| 6f 72 32 20 3d 20 72 65 | 61 72 52 69 67 68 74 3b |or2 = re|arRight;|
|00004de0| 0d 0a 20 20 20 20 72 65 | 61 72 52 69 67 68 74 2e |.. re|arRight.|
|00004df0| 57 68 65 65 6c 4a 6f 69 | 6e 74 2e 53 65 74 50 68 |WheelJoi|nt.SetPh|
|00004e00| 79 73 69 63 73 28 50 48 | 59 53 5f 4b 61 72 6d 61 |ysics(PH|YS_Karma|
|00004e10| 29 3b 0d 0a 0d 0a 09 2f | 2f 20 49 6e 69 74 69 61 |);...../|/ Initia|
|00004e20| 6c 6c 79 20 6d 61 6b 65 | 20 73 75 72 65 20 70 61 |lly make| sure pa|
|00004e30| 72 61 6d 65 74 65 72 73 | 20 61 72 65 20 73 79 6e |rameters| are syn|
|00004e40| 63 27 65 64 20 77 69 74 | 68 20 4b 61 72 6d 61 0d |c'ed wit|h Karma.|
|00004e50| 0a 09 4b 56 65 68 69 63 | 6c 65 55 70 64 61 74 65 |..KVehic|leUpdate|
|00004e60| 50 61 72 61 6d 73 28 29 | 3b 0d 0a 7d 0d 0a 0d 0a |Params()|;..}....|
|00004e70| 2f 2f 20 43 6c 65 61 6e | 20 75 70 20 77 68 65 65 |// Clean| up whee|
|00004e80| 6c 73 20 65 74 63 2e 0d | 0a 73 69 6d 75 6c 61 74 |ls etc..|.simulat|
|00004e90| 65 64 20 65 76 65 6e 74 | 20 44 65 73 74 72 6f 79 |ed event| Destroy|
|00004ea0| 65 64 28 29 0d 0a 7b 0d | 0a 09 2f 2f 20 44 65 73 |ed()..{.|..// Des|
|00004eb0| 74 72 6f 79 20 6a 6f 69 | 6e 74 73 20 68 6f 6c 64 |troy joi|nts hold|
|00004ec0| 69 6e 67 20 77 68 65 65 | 6c 73 20 74 6f 20 63 61 |ing whee|ls to ca|
|00004ed0| 72 0d 0a 09 66 72 6f 6e | 74 4c 65 66 74 2e 57 68 |r...fron|tLeft.Wh|
|00004ee0| 65 65 6c 4a 6f 69 6e 74 | 2e 44 65 73 74 72 6f 79 |eelJoint|.Destroy|
|00004ef0| 28 29 3b 0d 0a 09 66 72 | 6f 6e 74 52 69 67 68 74 |();...fr|ontRight|
|00004f00| 2e 57 68 65 65 6c 4a 6f | 69 6e 74 2e 44 65 73 74 |.WheelJo|int.Dest|
|00004f10| 72 6f 79 28 29 3b 0d 0a | 09 72 65 61 72 4c 65 66 |roy();..|.rearLef|
|00004f20| 74 2e 57 68 65 65 6c 4a | 6f 69 6e 74 2e 44 65 73 |t.WheelJ|oint.Des|
|00004f30| 74 72 6f 79 28 29 3b 0d | 0a 09 72 65 61 72 52 69 |troy();.|..rearRi|
|00004f40| 67 68 74 2e 57 68 65 65 | 6c 4a 6f 69 6e 74 2e 44 |ght.Whee|lJoint.D|
|00004f50| 65 73 74 72 6f 79 28 29 | 3b 0d 0a 0d 0a 09 2f 2f |estroy()|;.....//|
|00004f60| 20 44 65 73 74 72 6f 79 | 20 77 68 65 65 6c 73 20 | Destroy| wheels |
|00004f70| 74 68 65 6d 73 65 6c 76 | 65 73 2e 0d 0a 09 66 72 |themselv|es....fr|
|00004f80| 6f 6e 74 4c 65 66 74 2e | 44 65 73 74 72 6f 79 28 |ontLeft.|Destroy(|
|00004f90| 29 3b 0d 0a 09 66 72 6f | 6e 74 52 69 67 68 74 2e |);...fro|ntRight.|
|00004fa0| 44 65 73 74 72 6f 79 28 | 29 3b 0d 0a 09 72 65 61 |Destroy(|);...rea|
|00004fb0| 72 4c 65 66 74 2e 44 65 | 73 74 72 6f 79 28 29 3b |rLeft.De|stroy();|
|00004fc0| 0d 0a 09 72 65 61 72 52 | 69 67 68 74 2e 44 65 73 |...rearR|ight.Des|
|00004fd0| 74 72 6f 79 28 29 3b 0d | 0a 0d 0a 09 53 75 70 65 |troy();.|....Supe|
|00004fe0| 72 2e 44 65 73 74 72 6f | 79 65 64 28 29 3b 0d 0a |r.Destro|yed();..|
|00004ff0| 7d 0d 0a 0d 0a 2f 2f 20 | 43 61 6c 6c 20 74 68 69 |}....// |Call thi|
|00005000| 73 20 69 66 20 79 6f 75 | 20 63 68 61 6e 67 65 20 |s if you| change |
|00005010| 61 6e 79 20 70 61 72 61 | 6d 65 74 65 72 73 20 28 |any para|meters (|
|00005020| 74 69 72 65 2c 20 73 75 | 73 70 65 6e 73 69 6f 6e |tire, su|spension|
|00005030| 20 65 74 63 2e 29 20 61 | 6e 64 20 74 68 65 79 0d | etc.) a|nd they.|
|00005040| 0a 2f 2f 20 77 69 6c 6c | 20 62 65 20 70 61 73 73 |.// will| be pass|
|00005050| 65 64 20 64 6f 77 6e 20 | 74 6f 20 65 61 63 68 20 |ed down |to each |
|00005060| 77 68 65 65 6c 2f 6a 6f | 69 6e 74 2e 0d 0a 0d 0a |wheel/jo|int.....|
|00005070| 73 69 6d 75 6c 61 74 65 | 64 20 65 76 65 6e 74 20 |simulate|d event |
|00005080| 4b 56 65 68 69 63 6c 65 | 55 70 64 61 74 65 50 61 |KVehicle|UpdatePa|
|00005090| 72 61 6d 73 28 29 0d 0a | 7b 0d 0a 09 53 75 70 65 |rams()..|{...Supe|
|000050a0| 72 2e 4b 56 65 68 69 63 | 6c 65 55 70 64 61 74 65 |r.KVehic|leUpdate|
|000050b0| 50 61 72 61 6d 73 28 29 | 3b 0d 0a 0d 0a 20 20 20 |Params()|;.... |
|000050c0| 20 72 65 61 72 4c 65 66 | 74 2e 57 68 65 65 6c 4a | rearLef|t.WheelJ|
|000050d0| 6f 69 6e 74 2e 62 4b 53 | 74 65 65 72 69 6e 67 4c |oint.bKS|teeringL|
|000050e0| 6f 63 6b 65 64 20 3d 20 | 74 72 75 65 3b 0d 0a 20 |ocked = |true;.. |
|000050f0| 20 20 20 72 65 61 72 52 | 69 67 68 74 2e 57 68 65 | rearR|ight.Whe|
|00005100| 65 6c 4a 6f 69 6e 74 2e | 62 4b 53 74 65 65 72 69 |elJoint.|bKSteeri|
|00005110| 6e 67 4c 6f 63 6b 65 64 | 20 3d 20 74 72 75 65 3b |ngLocked| = true;|
|00005120| 0d 0a 20 20 20 20 0d 0a | 20 20 20 20 66 72 6f 6e |.. ..| fron|
|00005130| 74 4c 65 66 74 2e 57 68 | 65 65 6c 4a 6f 69 6e 74 |tLeft.Wh|eelJoint|
|00005140| 2e 62 4b 53 74 65 65 72 | 69 6e 67 4c 6f 63 6b 65 |.bKSteer|ingLocke|
|00005150| 64 20 3d 20 66 61 6c 73 | 65 3b 0d 0a 20 20 20 20 |d = fals|e;.. |
|00005160| 66 72 6f 6e 74 4c 65 66 | 74 2e 57 68 65 65 6c 4a |frontLef|t.WheelJ|
|00005170| 6f 69 6e 74 2e 4b 50 72 | 6f 70 6f 72 74 69 6f 6e |oint.KPr|oportion|
|00005180| 61 6c 47 61 70 20 3d 20 | 53 74 65 65 72 50 72 6f |alGap = |SteerPro|
|00005190| 70 47 61 70 3b 0d 0a 20 | 20 20 20 66 72 6f 6e 74 |pGap;.. | front|
|000051a0| 4c 65 66 74 2e 57 68 65 | 65 6c 4a 6f 69 6e 74 2e |Left.Whe|elJoint.|
|000051b0| 4b 4d 61 78 53 74 65 65 | 72 54 6f 72 71 75 65 20 |KMaxStee|rTorque |
|000051c0| 3d 20 53 74 65 65 72 54 | 6f 72 71 75 65 3b 0d 0a |= SteerT|orque;..|
|000051d0| 20 20 20 20 66 72 6f 6e | 74 4c 65 66 74 2e 57 68 | fron|tLeft.Wh|
|000051e0| 65 65 6c 4a 6f 69 6e 74 | 2e 4b 4d 61 78 53 74 65 |eelJoint|.KMaxSte|
|000051f0| 65 72 53 70 65 65 64 20 | 3d 20 53 74 65 65 72 53 |erSpeed |= SteerS|
|00005200| 70 65 65 64 3b 0d 0a 0d | 0a 20 20 20 20 66 72 6f |peed;...|. fro|
|00005210| 6e 74 52 69 67 68 74 2e | 57 68 65 65 6c 4a 6f 69 |ntRight.|WheelJoi|
|00005220| 6e 74 2e 62 4b 53 74 65 | 65 72 69 6e 67 4c 6f 63 |nt.bKSte|eringLoc|
|00005230| 6b 65 64 20 3d 20 66 61 | 6c 73 65 3b 0d 0a 20 20 |ked = fa|lse;.. |
|00005240| 20 20 66 72 6f 6e 74 52 | 69 67 68 74 2e 57 68 65 | frontR|ight.Whe|
|00005250| 65 6c 4a 6f 69 6e 74 2e | 4b 50 72 6f 70 6f 72 74 |elJoint.|KProport|
|00005260| 69 6f 6e 61 6c 47 61 70 | 20 3d 20 53 74 65 65 72 |ionalGap| = Steer|
|00005270| 50 72 6f 70 47 61 70 3b | 0d 0a 20 20 20 20 66 72 |PropGap;|.. fr|
|00005280| 6f 6e 74 52 69 67 68 74 | 2e 57 68 65 65 6c 4a 6f |ontRight|.WheelJo|
|00005290| 69 6e 74 2e 4b 4d 61 78 | 53 74 65 65 72 54 6f 72 |int.KMax|SteerTor|
|000052a0| 71 75 65 20 3d 20 53 74 | 65 65 72 54 6f 72 71 75 |que = St|eerTorqu|
|000052b0| 65 3b 0d 0a 20 20 20 20 | 66 72 6f 6e 74 52 69 67 |e;.. |frontRig|
|000052c0| 68 74 2e 57 68 65 65 6c | 4a 6f 69 6e 74 2e 4b 4d |ht.Wheel|Joint.KM|
|000052d0| 61 78 53 74 65 65 72 53 | 70 65 65 64 20 3d 20 53 |axSteerS|peed = S|
|000052e0| 74 65 65 72 53 70 65 65 | 64 3b 0d 0a 0d 0a 20 20 |teerSpee|d;.... |
|000052f0| 20 20 66 72 6f 6e 74 4c | 65 66 74 2e 57 68 65 65 | frontL|eft.Whee|
|00005300| 6c 4a 6f 69 6e 74 2e 4b | 53 75 73 70 48 69 67 68 |lJoint.K|SuspHigh|
|00005310| 4c 69 6d 69 74 20 3d 20 | 53 75 73 70 48 69 67 68 |Limit = |SuspHigh|
|00005320| 4c 69 6d 69 74 3b 0d 0a | 20 20 20 20 66 72 6f 6e |Limit;..| fron|
|00005330| 74 4c 65 66 74 2e 57 68 | 65 65 6c 4a 6f 69 6e 74 |tLeft.Wh|eelJoint|
|00005340| 2e 4b 53 75 73 70 4c 6f | 77 4c 69 6d 69 74 20 3d |.KSuspLo|wLimit =|
|00005350| 20 53 75 73 70 4c 6f 77 | 4c 69 6d 69 74 3b 0d 0a | SuspLow|Limit;..|
|00005360| 20 20 20 20 66 72 6f 6e | 74 4c 65 66 74 2e 57 68 | fron|tLeft.Wh|
|00005370| 65 65 6c 4a 6f 69 6e 74 | 2e 4b 53 75 73 70 53 74 |eelJoint|.KSuspSt|
|00005380| 69 66 66 6e 65 73 73 20 | 3d 20 53 75 73 70 53 74 |iffness |= SuspSt|
|00005390| 69 66 66 6e 65 73 73 3b | 0d 0a 20 20 20 20 66 72 |iffness;|.. fr|
|000053a0| 6f 6e 74 4c 65 66 74 2e | 57 68 65 65 6c 4a 6f 69 |ontLeft.|WheelJoi|
|000053b0| 6e 74 2e 4b 53 75 73 70 | 44 61 6d 70 69 6e 67 20 |nt.KSusp|Damping |
|000053c0| 3d 20 53 75 73 70 44 61 | 6d 70 69 6e 67 3b 0d 0a |= SuspDa|mping;..|
|000053d0| 0d 0a 20 20 20 20 66 72 | 6f 6e 74 52 69 67 68 74 |.. fr|ontRight|
|000053e0| 2e 57 68 65 65 6c 4a 6f | 69 6e 74 2e 4b 53 75 73 |.WheelJo|int.KSus|
|000053f0| 70 48 69 67 68 4c 69 6d | 69 74 20 3d 20 53 75 73 |pHighLim|it = Sus|
|00005400| 70 48 69 67 68 4c 69 6d | 69 74 3b 0d 0a 20 20 20 |pHighLim|it;.. |
|00005410| 20 66 72 6f 6e 74 52 69 | 67 68 74 2e 57 68 65 65 | frontRi|ght.Whee|
|00005420| 6c 4a 6f 69 6e 74 2e 4b | 53 75 73 70 4c 6f 77 4c |lJoint.K|SuspLowL|
|00005430| 69 6d 69 74 20 3d 20 53 | 75 73 70 4c 6f 77 4c 69 |imit = S|uspLowLi|
|00005440| 6d 69 74 3b 0d 0a 20 20 | 20 20 66 72 6f 6e 74 52 |mit;.. | frontR|
|00005450| 69 67 68 74 2e 57 68 65 | 65 6c 4a 6f 69 6e 74 2e |ight.Whe|elJoint.|
|00005460| 4b 53 75 73 70 53 74 69 | 66 66 6e 65 73 73 20 3d |KSuspSti|ffness =|
|00005470| 20 53 75 73 70 53 74 69 | 66 66 6e 65 73 73 3b 0d | SuspSti|ffness;.|
|00005480| 0a 20 20 20 20 66 72 6f | 6e 74 52 69 67 68 74 2e |. fro|ntRight.|
|00005490| 57 68 65 65 6c 4a 6f 69 | 6e 74 2e 4b 53 75 73 70 |WheelJoi|nt.KSusp|
|000054a0| 44 61 6d 70 69 6e 67 20 | 3d 20 53 75 73 70 44 61 |Damping |= SuspDa|
|000054b0| 6d 70 69 6e 67 3b 0d 0a | 0d 0a 20 20 20 20 72 65 |mping;..|.. re|
|000054c0| 61 72 4c 65 66 74 2e 57 | 68 65 65 6c 4a 6f 69 6e |arLeft.W|heelJoin|
|000054d0| 74 2e 4b 53 75 73 70 48 | 69 67 68 4c 69 6d 69 74 |t.KSuspH|ighLimit|
|000054e0| 20 3d 20 53 75 73 70 48 | 69 67 68 4c 69 6d 69 74 | = SuspH|ighLimit|
|000054f0| 3b 0d 0a 20 20 20 20 72 | 65 61 72 4c 65 66 74 2e |;.. r|earLeft.|
|00005500| 57 68 65 65 6c 4a 6f 69 | 6e 74 2e 4b 53 75 73 70 |WheelJoi|nt.KSusp|
|00005510| 4c 6f 77 4c 69 6d 69 74 | 20 3d 20 53 75 73 70 4c |LowLimit| = SuspL|
|00005520| 6f 77 4c 69 6d 69 74 3b | 0d 0a 20 20 20 20 72 65 |owLimit;|.. re|
|00005530| 61 72 4c 65 66 74 2e 57 | 68 65 65 6c 4a 6f 69 6e |arLeft.W|heelJoin|
|00005540| 74 2e 4b 53 75 73 70 53 | 74 69 66 66 6e 65 73 73 |t.KSuspS|tiffness|
|00005550| 20 3d 20 53 75 73 70 53 | 74 69 66 66 6e 65 73 73 | = SuspS|tiffness|
|00005560| 3b 0d 0a 20 20 20 20 72 | 65 61 72 4c 65 66 74 2e |;.. r|earLeft.|
|00005570| 57 68 65 65 6c 4a 6f 69 | 6e 74 2e 4b 53 75 73 70 |WheelJoi|nt.KSusp|
|00005580| 44 61 6d 70 69 6e 67 20 | 3d 20 53 75 73 70 44 61 |Damping |= SuspDa|
|00005590| 6d 70 69 6e 67 3b 0d 0a | 0d 0a 20 20 20 20 72 65 |mping;..|.. re|
|000055a0| 61 72 52 69 67 68 74 2e | 57 68 65 65 6c 4a 6f 69 |arRight.|WheelJoi|
|000055b0| 6e 74 2e 4b 53 75 73 70 | 48 69 67 68 4c 69 6d 69 |nt.KSusp|HighLimi|
|000055c0| 74 20 3d 20 53 75 73 70 | 48 69 67 68 4c 69 6d 69 |t = Susp|HighLimi|
|000055d0| 74 3b 0d 0a 20 20 20 20 | 72 65 61 72 52 69 67 68 |t;.. |rearRigh|
|000055e0| 74 2e 57 68 65 65 6c 4a | 6f 69 6e 74 2e 4b 53 75 |t.WheelJ|oint.KSu|
|000055f0| 73 70 4c 6f 77 4c 69 6d | 69 74 20 3d 20 53 75 73 |spLowLim|it = Sus|
|00005600| 70 4c 6f 77 4c 69 6d 69 | 74 3b 0d 0a 20 20 20 20 |pLowLimi|t;.. |
|00005610| 72 65 61 72 52 69 67 68 | 74 2e 57 68 65 65 6c 4a |rearRigh|t.WheelJ|
|00005620| 6f 69 6e 74 2e 4b 53 75 | 73 70 53 74 69 66 66 6e |oint.KSu|spStiffn|
|00005630| 65 73 73 20 3d 20 53 75 | 73 70 53 74 69 66 66 6e |ess = Su|spStiffn|
|00005640| 65 73 73 3b 0d 0a 20 20 | 20 20 72 65 61 72 52 69 |ess;.. | rearRi|
|00005650| 67 68 74 2e 57 68 65 65 | 6c 4a 6f 69 6e 74 2e 4b |ght.Whee|lJoint.K|
|00005660| 53 75 73 70 44 61 6d 70 | 69 6e 67 20 3d 20 53 75 |SuspDamp|ing = Su|
|00005670| 73 70 44 61 6d 70 69 6e | 67 3b 0d 0a 0d 0a 09 2f |spDampin|g;...../|
|00005680| 2f 20 53 79 6e 63 20 70 | 61 72 61 6d 73 20 77 69 |/ Sync p|arams wi|
|00005690| 74 68 20 4b 61 72 6d 61 | 2e 0d 0a 09 66 72 6f 6e |th Karma|....fron|
|000056a0| 74 4c 65 66 74 2e 57 68 | 65 65 6c 4a 6f 69 6e 74 |tLeft.Wh|eelJoint|
|000056b0| 2e 4b 55 70 64 61 74 65 | 43 6f 6e 73 74 72 61 69 |.KUpdate|Constrai|
|000056c0| 6e 74 50 61 72 61 6d 73 | 28 29 3b 0d 0a 09 66 72 |ntParams|();...fr|
|000056d0| 6f 6e 74 52 69 67 68 74 | 2e 57 68 65 65 6c 4a 6f |ontRight|.WheelJo|
|000056e0| 69 6e 74 2e 4b 55 70 64 | 61 74 65 43 6f 6e 73 74 |int.KUpd|ateConst|
|000056f0| 72 61 69 6e 74 50 61 72 | 61 6d 73 28 29 3b 0d 0a |raintPar|ams();..|
|00005700| 09 72 65 61 72 4c 65 66 | 74 2e 57 68 65 65 6c 4a |.rearLef|t.WheelJ|
|00005710| 6f 69 6e 74 2e 4b 55 70 | 64 61 74 65 43 6f 6e 73 |oint.KUp|dateCons|
|00005720| 74 72 61 69 6e 74 50 61 | 72 61 6d 73 28 29 3b 0d |traintPa|rams();.|
|00005730| 0a 09 72 65 61 72 52 69 | 67 68 74 2e 57 68 65 65 |..rearRi|ght.Whee|
|00005740| 6c 4a 6f 69 6e 74 2e 4b | 55 70 64 61 74 65 43 6f |lJoint.K|UpdateCo|
|00005750| 6e 73 74 72 61 69 6e 74 | 50 61 72 61 6d 73 28 29 |nstraint|Params()|
|00005760| 3b 0d 0a 0d 0a 20 20 20 | 20 2f 2f 20 4d 61 73 73 |;.... | // Mass|
|00005770| 0d 0a 20 20 20 20 4b 53 | 65 74 4d 61 73 73 28 43 |.. KS|etMass(C|
|00005780| 68 61 73 73 69 73 4d 61 | 73 73 29 3b 0d 0a 20 20 |hassisMa|ss);.. |
|00005790| 20 20 66 72 6f 6e 74 4c | 65 66 74 2e 4b 53 65 74 | frontL|eft.KSet|
|000057a0| 4d 61 73 73 28 54 69 72 | 65 4d 61 73 73 29 3b 0d |Mass(Tir|eMass);.|
|000057b0| 0a 20 20 20 20 66 72 6f | 6e 74 52 69 67 68 74 2e |. fro|ntRight.|
|000057c0| 4b 53 65 74 4d 61 73 73 | 28 54 69 72 65 4d 61 73 |KSetMass|(TireMas|
|000057d0| 73 29 3b 0d 0a 20 20 20 | 20 72 65 61 72 4c 65 66 |s);.. | rearLef|
|000057e0| 74 2e 4b 53 65 74 4d 61 | 73 73 28 54 69 72 65 4d |t.KSetMa|ss(TireM|
|000057f0| 61 73 73 29 3b 0d 0a 20 | 20 20 20 72 65 61 72 52 |ass);.. | rearR|
|00005800| 69 67 68 74 2e 4b 53 65 | 74 4d 61 73 73 28 54 69 |ight.KSe|tMass(Ti|
|00005810| 72 65 4d 61 73 73 29 3b | 0d 0a 0d 0a 20 20 20 20 |reMass);|.... |
|00005820| 2f 2f 20 54 69 72 65 20 | 70 61 72 61 6d 73 20 68 |// Tire |params h|
|00005830| 61 6e 64 79 20 74 75 6e | 69 6e 67 0d 0a 20 20 20 |andy tun|ing.. |
|00005840| 20 66 72 6f 6e 74 4c 65 | 66 74 2e 52 6f 6c 6c 46 | frontLe|ft.RollF|
|00005850| 72 69 63 74 69 6f 6e 20 | 3d 20 54 69 72 65 52 6f |riction |= TireRo|
|00005860| 6c 6c 46 72 69 63 74 69 | 6f 6e 3b 0d 0a 20 20 20 |llFricti|on;.. |
|00005870| 20 66 72 6f 6e 74 4c 65 | 66 74 2e 4c 61 74 65 72 | frontLe|ft.Later|
|00005880| 61 6c 46 72 69 63 74 69 | 6f 6e 20 3d 20 54 69 72 |alFricti|on = Tir|
|00005890| 65 4c 61 74 65 72 61 6c | 46 72 69 63 74 69 6f 6e |eLateral|Friction|
|000058a0| 3b 0d 0a 20 20 20 20 66 | 72 6f 6e 74 4c 65 66 74 |;.. f|rontLeft|
|000058b0| 2e 52 6f 6c 6c 53 6c 69 | 70 20 3d 20 54 69 72 65 |.RollSli|p = Tire|
|000058c0| 52 6f 6c 6c 53 6c 69 70 | 3b 0d 0a 20 20 20 20 66 |RollSlip|;.. f|
|000058d0| 72 6f 6e 74 4c 65 66 74 | 2e 4c 61 74 65 72 61 6c |rontLeft|.Lateral|
|000058e0| 53 6c 69 70 20 3d 20 54 | 69 72 65 4c 61 74 65 72 |Slip = T|ireLater|
|000058f0| 61 6c 53 6c 69 70 3b 0d | 0a 20 20 20 20 66 72 6f |alSlip;.|. fro|
|00005900| 6e 74 4c 65 66 74 2e 4d | 69 6e 53 6c 69 70 20 3d |ntLeft.M|inSlip =|
|00005910| 20 54 69 72 65 4d 69 6e | 53 6c 69 70 3b 0d 0a 20 | TireMin|Slip;.. |
|00005920| 20 20 20 66 72 6f 6e 74 | 4c 65 66 74 2e 53 6c 69 | front|Left.Sli|
|00005930| 70 52 61 74 65 20 3d 20 | 54 69 72 65 53 6c 69 70 |pRate = |TireSlip|
|00005940| 52 61 74 65 3b 0d 0a 20 | 20 20 20 66 72 6f 6e 74 |Rate;.. | front|
|00005950| 4c 65 66 74 2e 53 6f 66 | 74 6e 65 73 73 20 3d 20 |Left.Sof|tness = |
|00005960| 54 69 72 65 53 6f 66 74 | 6e 65 73 73 3b 0d 0a 20 |TireSoft|ness;.. |
|00005970| 20 20 20 66 72 6f 6e 74 | 4c 65 66 74 2e 41 64 68 | front|Left.Adh|
|00005980| 65 73 69 6f 6e 20 3d 20 | 54 69 72 65 41 64 68 65 |esion = |TireAdhe|
|00005990| 73 69 6f 6e 3b 0d 0a 20 | 20 20 20 66 72 6f 6e 74 |sion;.. | front|
|000059a0| 4c 65 66 74 2e 52 65 73 | 74 69 74 75 74 69 6f 6e |Left.Res|titution|
|000059b0| 20 3d 20 54 69 72 65 52 | 65 73 74 69 74 75 74 69 | = TireR|estituti|
|000059c0| 6f 6e 3b 0d 0a 0d 0a 20 | 20 20 20 66 72 6f 6e 74 |on;.... | front|
|000059d0| 52 69 67 68 74 2e 52 6f | 6c 6c 46 72 69 63 74 69 |Right.Ro|llFricti|
|000059e0| 6f 6e 20 3d 20 54 69 72 | 65 52 6f 6c 6c 46 72 69 |on = Tir|eRollFri|
|000059f0| 63 74 69 6f 6e 3b 0d 0a | 20 20 20 20 66 72 6f 6e |ction;..| fron|
|00005a00| 74 52 69 67 68 74 2e 4c | 61 74 65 72 61 6c 46 72 |tRight.L|ateralFr|
|00005a10| 69 63 74 69 6f 6e 20 3d | 20 54 69 72 65 4c 61 74 |iction =| TireLat|
|00005a20| 65 72 61 6c 46 72 69 63 | 74 69 6f 6e 3b 0d 0a 20 |eralFric|tion;.. |
|00005a30| 20 20 20 66 72 6f 6e 74 | 52 69 67 68 74 2e 52 6f | front|Right.Ro|
|00005a40| 6c 6c 53 6c 69 70 20 3d | 20 54 69 72 65 52 6f 6c |llSlip =| TireRol|
|00005a50| 6c 53 6c 69 70 3b 0d 0a | 20 20 20 20 66 72 6f 6e |lSlip;..| fron|
|00005a60| 74 52 69 67 68 74 2e 4c | 61 74 65 72 61 6c 53 6c |tRight.L|ateralSl|
|00005a70| 69 70 20 3d 20 54 69 72 | 65 4c 61 74 65 72 61 6c |ip = Tir|eLateral|
|00005a80| 53 6c 69 70 3b 0d 0a 20 | 20 20 20 66 72 6f 6e 74 |Slip;.. | front|
|00005a90| 52 69 67 68 74 2e 4d 69 | 6e 53 6c 69 70 20 3d 20 |Right.Mi|nSlip = |
|00005aa0| 54 69 72 65 4d 69 6e 53 | 6c 69 70 3b 0d 0a 20 20 |TireMinS|lip;.. |
|00005ab0| 20 20 66 72 6f 6e 74 52 | 69 67 68 74 2e 53 6c 69 | frontR|ight.Sli|
|00005ac0| 70 52 61 74 65 20 3d 20 | 54 69 72 65 53 6c 69 70 |pRate = |TireSlip|
|00005ad0| 52 61 74 65 3b 0d 0a 20 | 20 20 20 66 72 6f 6e 74 |Rate;.. | front|
|00005ae0| 52 69 67 68 74 2e 53 6f | 66 74 6e 65 73 73 20 3d |Right.So|ftness =|
|00005af0| 20 54 69 72 65 53 6f 66 | 74 6e 65 73 73 3b 0d 0a | TireSof|tness;..|
|00005b00| 20 20 20 20 66 72 6f 6e | 74 52 69 67 68 74 2e 41 | fron|tRight.A|
|00005b10| 64 68 65 73 69 6f 6e 20 | 3d 20 54 69 72 65 41 64 |dhesion |= TireAd|
|00005b20| 68 65 73 69 6f 6e 3b 0d | 0a 20 20 20 20 66 72 6f |hesion;.|. fro|
|00005b30| 6e 74 52 69 67 68 74 2e | 52 65 73 74 69 74 75 74 |ntRight.|Restitut|
|00005b40| 69 6f 6e 20 3d 20 54 69 | 72 65 52 65 73 74 69 74 |ion = Ti|reRestit|
|00005b50| 75 74 69 6f 6e 3b 0d 0a | 0d 0a 20 20 20 20 72 65 |ution;..|.. re|
|00005b60| 61 72 4c 65 66 74 2e 52 | 6f 6c 6c 46 72 69 63 74 |arLeft.R|ollFrict|
|00005b70| 69 6f 6e 20 3d 20 54 69 | 72 65 52 6f 6c 6c 46 72 |ion = Ti|reRollFr|
|00005b80| 69 63 74 69 6f 6e 3b 0d | 0a 20 20 20 20 72 65 61 |iction;.|. rea|
|00005b90| 72 4c 65 66 74 2e 4c 61 | 74 65 72 61 6c 46 72 69 |rLeft.La|teralFri|
|00005ba0| 63 74 69 6f 6e 20 3d 20 | 54 69 72 65 4c 61 74 65 |ction = |TireLate|
|00005bb0| 72 61 6c 46 72 69 63 74 | 69 6f 6e 3b 0d 0a 20 20 |ralFrict|ion;.. |
|00005bc0| 20 20 72 65 61 72 4c 65 | 66 74 2e 52 6f 6c 6c 53 | rearLe|ft.RollS|
|00005bd0| 6c 69 70 20 3d 20 54 69 | 72 65 52 6f 6c 6c 53 6c |lip = Ti|reRollSl|
|00005be0| 69 70 3b 0d 0a 20 20 20 | 20 72 65 61 72 4c 65 66 |ip;.. | rearLef|
|00005bf0| 74 2e 4c 61 74 65 72 61 | 6c 53 6c 69 70 20 3d 20 |t.Latera|lSlip = |
|00005c00| 54 69 72 65 4c 61 74 65 | 72 61 6c 53 6c 69 70 3b |TireLate|ralSlip;|
|00005c10| 0d 0a 20 20 20 20 72 65 | 61 72 4c 65 66 74 2e 4d |.. re|arLeft.M|
|00005c20| 69 6e 53 6c 69 70 20 3d | 20 54 69 72 65 4d 69 6e |inSlip =| TireMin|
|00005c30| 53 6c 69 70 3b 0d 0a 20 | 20 20 20 72 65 61 72 4c |Slip;.. | rearL|
|00005c40| 65 66 74 2e 53 6c 69 70 | 52 61 74 65 20 3d 20 54 |eft.Slip|Rate = T|
|00005c50| 69 72 65 53 6c 69 70 52 | 61 74 65 3b 0d 0a 20 20 |ireSlipR|ate;.. |
|00005c60| 20 20 72 65 61 72 4c 65 | 66 74 2e 53 6f 66 74 6e | rearLe|ft.Softn|
|00005c70| 65 73 73 20 3d 20 54 69 | 72 65 53 6f 66 74 6e 65 |ess = Ti|reSoftne|
|00005c80| 73 73 3b 0d 0a 20 20 20 | 20 72 65 61 72 4c 65 66 |ss;.. | rearLef|
|00005c90| 74 2e 41 64 68 65 73 69 | 6f 6e 20 3d 20 54 69 72 |t.Adhesi|on = Tir|
|00005ca0| 65 41 64 68 65 73 69 6f | 6e 3b 0d 0a 20 20 20 20 |eAdhesio|n;.. |
|00005cb0| 72 65 61 72 4c 65 66 74 | 2e 52 65 73 74 69 74 75 |rearLeft|.Restitu|
|00005cc0| 74 69 6f 6e 20 3d 20 54 | 69 72 65 52 65 73 74 69 |tion = T|ireResti|
|00005cd0| 74 75 74 69 6f 6e 3b 0d | 0a 0d 0a 20 20 20 20 72 |tution;.|... r|
|00005ce0| 65 61 72 52 69 67 68 74 | 2e 52 6f 6c 6c 46 72 69 |earRight|.RollFri|
|00005cf0| 63 74 69 6f 6e 20 3d 20 | 54 69 72 65 52 6f 6c 6c |ction = |TireRoll|
|00005d00| 46 72 69 63 74 69 6f 6e | 3b 0d 0a 20 20 20 20 72 |Friction|;.. r|
|00005d10| 65 61 72 52 69 67 68 74 | 2e 4c 61 74 65 72 61 6c |earRight|.Lateral|
|00005d20| 46 72 69 63 74 69 6f 6e | 20 3d 20 54 69 72 65 4c |Friction| = TireL|
|00005d30| 61 74 65 72 61 6c 46 72 | 69 63 74 69 6f 6e 3b 0d |ateralFr|iction;.|
|00005d40| 0a 20 20 20 20 72 65 61 | 72 52 69 67 68 74 2e 52 |. rea|rRight.R|
|00005d50| 6f 6c 6c 53 6c 69 70 20 | 3d 20 54 69 72 65 52 6f |ollSlip |= TireRo|
|00005d60| 6c 6c 53 6c 69 70 3b 0d | 0a 20 20 20 20 72 65 61 |llSlip;.|. rea|
|00005d70| 72 52 69 67 68 74 2e 4c | 61 74 65 72 61 6c 53 6c |rRight.L|ateralSl|
|00005d80| 69 70 20 3d 20 54 69 72 | 65 4c 61 74 65 72 61 6c |ip = Tir|eLateral|
|00005d90| 53 6c 69 70 3b 0d 0a 20 | 20 20 20 72 65 61 72 52 |Slip;.. | rearR|
|00005da0| 69 67 68 74 2e 4d 69 6e | 53 6c 69 70 20 3d 20 54 |ight.Min|Slip = T|
|00005db0| 69 72 65 4d 69 6e 53 6c | 69 70 3b 0d 0a 20 20 20 |ireMinSl|ip;.. |
|00005dc0| 20 72 65 61 72 52 69 67 | 68 74 2e 53 6c 69 70 52 | rearRig|ht.SlipR|
|00005dd0| 61 74 65 20 3d 20 54 69 | 72 65 53 6c 69 70 52 61 |ate = Ti|reSlipRa|
|00005de0| 74 65 3b 0d 0a 20 20 20 | 20 72 65 61 72 52 69 67 |te;.. | rearRig|
|00005df0| 68 74 2e 53 6f 66 74 6e | 65 73 73 20 3d 20 54 69 |ht.Softn|ess = Ti|
|00005e00| 72 65 53 6f 66 74 6e 65 | 73 73 3b 0d 0a 20 20 20 |reSoftne|ss;.. |
|00005e10| 20 72 65 61 72 52 69 67 | 68 74 2e 41 64 68 65 73 | rearRig|ht.Adhes|
|00005e20| 69 6f 6e 20 3d 20 54 69 | 72 65 41 64 68 65 73 69 |ion = Ti|reAdhesi|
|00005e30| 6f 6e 3b 0d 0a 20 20 20 | 20 72 65 61 72 52 69 67 |on;.. | rearRig|
|00005e40| 68 74 2e 52 65 73 74 69 | 74 75 74 69 6f 6e 20 3d |ht.Resti|tution =|
|00005e50| 20 54 69 72 65 52 65 73 | 74 69 74 75 74 69 6f 6e | TireRes|titution|
|00005e60| 3b 0d 0a 7d 0d 0a 0d 0a | 2f 2f 20 50 6f 73 73 69 |;..}....|// Possi|
|00005e70| 62 6c 79 20 61 70 70 6c | 79 20 66 6f 72 63 65 20 |bly appl|y force |
|00005e80| 74 6f 20 66 6c 69 70 20 | 63 61 72 20 6f 76 65 72 |to flip |car over|
|00005e90| 2e 0d 0a 73 69 6d 75 6c | 61 74 65 64 20 65 76 65 |...simul|ated eve|
|00005ea0| 6e 74 20 4b 41 70 70 6c | 79 46 6f 72 63 65 28 6f |nt KAppl|yForce(o|
|00005eb0| 75 74 20 76 65 63 74 6f | 72 20 46 6f 72 63 65 2c |ut vecto|r Force,|
|00005ec0| 20 6f 75 74 20 76 65 63 | 74 6f 72 20 54 6f 72 71 | out vec|tor Torq|
|00005ed0| 75 65 29 0d 0a 7b 0d 0a | 09 6c 6f 63 61 6c 20 66 |ue)..{..|.local f|
|00005ee0| 6c 6f 61 74 20 74 6f 72 | 71 75 65 53 63 61 6c 65 |loat tor|queScale|
|00005ef0| 3b 0d 0a 09 6c 6f 63 61 | 6c 20 76 65 63 74 6f 72 |;...loca|l vector|
|00005f00| 20 77 6f 72 6c 64 46 6f | 72 77 61 72 64 2c 20 77 | worldFo|rward, w|
|00005f10| 6f 72 6c 64 55 70 2c 20 | 77 6f 72 6c 64 52 69 67 |orldUp, |worldRig|
|00005f20| 68 74 2c 20 74 6f 72 71 | 75 65 41 78 69 73 3b 0d |ht, torq|ueAxis;.|
|00005f30| 0a 0d 0a 09 69 66 28 46 | 6c 69 70 54 69 6d 65 4c |....if(F|lipTimeL|
|00005f40| 65 66 74 20 3d 3d 20 30 | 29 0d 0a 09 09 72 65 74 |eft == 0|)....ret|
|00005f50| 75 72 6e 3b 0d 0a 0d 0a | 09 77 6f 72 6c 64 46 6f |urn;....|.worldFo|
|00005f60| 72 77 61 72 64 20 3d 20 | 76 65 63 74 28 2d 31 2c |rward = |vect(-1,|
|00005f70| 20 30 2c 20 30 29 20 3e | 3e 20 52 6f 74 61 74 69 | 0, 0) >|> Rotati|
|00005f80| 6f 6e 3b 0d 0a 09 77 6f | 72 6c 64 55 70 20 3d 20 |on;...wo|rldUp = |
|00005f90| 76 65 63 74 28 30 2c 20 | 30 2c 20 31 29 20 3e 3e |vect(0, |0, 1) >>|
|00005fa0| 20 52 6f 74 61 74 69 6f | 6e 3b 0d 0a 09 77 6f 72 | Rotatio|n;...wor|
|00005fb0| 6c 64 52 69 67 68 74 20 | 3d 20 76 65 63 74 28 30 |ldRight |= vect(0|
|00005fc0| 2c 20 31 2c 20 30 29 20 | 3e 3e 20 52 6f 74 61 74 |, 1, 0) |>> Rotat|
|00005fd0| 69 6f 6e 3b 0d 0a 0d 0a | 09 74 6f 72 71 75 65 41 |ion;....|.torqueA|
|00005fe0| 78 69 73 20 3d 20 4e 6f | 72 6d 61 6c 28 77 6f 72 |xis = No|rmal(wor|
|00005ff0| 6c 64 55 70 20 43 72 6f | 73 73 20 76 65 63 74 28 |ldUp Cro|ss vect(|
|00006000| 30 2c 20 30 2c 20 31 29 | 29 3b 0d 0a 0d 0a 09 2f |0, 0, 1)|);...../|
|00006010| 2f 20 54 6f 72 71 75 65 | 20 73 63 61 6c 65 64 20 |/ Torque| scaled |
|00006020| 62 79 20 68 6f 77 20 66 | 61 72 20 6f 76 65 72 20 |by how f|ar over |
|00006030| 77 65 20 61 72 65 2e 20 | 0d 0a 09 2f 2f 20 54 68 |we are. |...// Th|
|00006040| 69 73 20 77 69 6c 6c 20 | 62 65 20 62 65 74 77 65 |is will |be betwe|
|00006050| 65 6e 20 30 20 61 6e 64 | 20 50 49 20 2d 20 73 6f |en 0 and| PI - so|
|00006060| 20 63 6f 6e 76 65 72 74 | 20 74 6f 20 62 65 74 77 | convert| to betw|
|00006070| 65 65 6e 20 30 20 61 6e | 64 20 31 2e 0d 0a 09 74 |een 0 an|d 1....t|
|00006080| 6f 72 71 75 65 53 63 61 | 6c 65 20 3d 20 41 63 6f |orqueSca|le = Aco|
|00006090| 73 28 77 6f 72 6c 64 55 | 70 20 44 6f 74 20 76 65 |s(worldU|p Dot ve|
|000060a0| 63 74 28 30 2c 20 30 2c | 20 31 29 29 2f 33 2e 31 |ct(0, 0,| 1))/3.1|
|000060b0| 34 31 36 3b 0d 0a 0d 0a | 09 54 6f 72 71 75 65 20 |416;....|.Torque |
|000060c0| 3d 20 46 6c 69 70 54 6f | 72 71 75 65 20 2a 20 74 |= FlipTo|rque * t|
|000060d0| 6f 72 71 75 65 53 63 61 | 6c 65 20 2a 20 74 6f 72 |orqueSca|le * tor|
|000060e0| 71 75 65 41 78 69 73 3b | 0d 0a 7d 0d 0a 0d 0a 66 |queAxis;|..}....f|
|000060f0| 75 6e 63 74 69 6f 6e 20 | 53 74 61 72 74 46 6c 69 |unction |StartFli|
|00006100| 70 28 50 61 77 6e 20 50 | 75 73 68 65 72 29 0d 0a |p(Pawn P|usher)..|
|00006110| 7b 0d 0a 09 2f 2f 6c 6f | 63 61 6c 20 76 65 63 74 |{...//lo|cal vect|
|00006120| 6f 72 20 74 6f 50 75 73 | 68 65 72 2c 20 77 6f 72 |or toPus|her, wor|
|00006130| 6c 64 55 70 3b 0d 0a 0d | 0a 09 2f 2f 20 69 66 20 |ldUp;...|..// if |
|00006140| 77 65 20 61 72 65 20 61 | 6c 72 65 61 64 79 20 66 |we are a|lready f|
|00006150| 6c 69 70 70 69 6e 67 20 | 74 68 65 20 63 61 72 20 |lipping |the car |
|00006160| 2d 20 64 6f 6e 74 20 64 | 6f 20 69 74 20 61 67 61 |- dont d|o it aga|
|00006170| 69 6e 21 0d 0a 09 69 66 | 28 46 6c 69 70 54 69 6d |in!...if|(FlipTim|
|00006180| 65 4c 65 66 74 20 3e 20 | 30 29 0d 0a 09 09 72 65 |eLeft > |0)....re|
|00006190| 74 75 72 6e 3b 0d 0a 0d | 0a 09 2f 2f 20 44 6f 6e |turn;...|..// Don|
|000061a0| 74 20 6c 65 74 20 79 6f | 75 20 70 75 73 68 20 74 |t let yo|u push t|
|000061b0| 68 65 20 63 61 72 20 69 | 66 20 79 6f 75 20 61 72 |he car i|f you ar|
|000061c0| 65 20 67 6f 69 6e 67 20 | 74 6f 20 62 65 20 75 6e |e going |to be un|
|000061d0| 64 65 72 6e 65 61 74 68 | 20 69 74 21 0d 0a 20 20 |derneath| it!.. |
|000061e0| 09 2f 2f 77 6f 72 6c 64 | 55 70 20 3d 20 76 65 63 |.//world|Up = vec|
|000061f0| 74 28 30 2c 20 30 2c 20 | 31 29 20 3e 3e 20 52 6f |t(0, 0, |1) >> Ro|
|00006200| 74 61 74 69 6f 6e 3b 0d | 0a 09 2f 2f 74 6f 50 75 |tation;.|..//toPu|
|00006210| 73 68 65 72 20 3d 20 50 | 75 73 68 65 72 2e 4c 6f |sher = P|usher.Lo|
|00006220| 63 61 74 69 6f 6e 20 2d | 20 4c 6f 63 61 74 69 6f |cation -| Locatio|
|00006230| 6e 3b 0d 0a 09 2f 2f 69 | 66 28 20 28 77 6f 72 6c |n;...//i|f( (worl|
|00006240| 64 55 70 20 44 6f 74 20 | 74 6f 50 75 73 68 65 72 |dUp Dot |toPusher|
|00006250| 29 20 3c 20 30 29 0d 0a | 09 2f 2f 09 72 65 74 75 |) < 0)..|.//.retu|
|00006260| 72 6e 3b 0d 0a 0d 0a 09 | 46 6c 69 70 54 69 6d 65 |rn;.....|FlipTime|
|00006270| 4c 65 66 74 20 3d 20 46 | 6c 69 70 54 69 6d 65 3b |Left = F|lipTime;|
|00006280| 20 2f 2f 20 53 74 61 72 | 74 20 74 68 65 20 66 6c | // Star|t the fl|
|00006290| 69 70 20 6f 6e 20 74 68 | 65 20 73 65 72 76 65 72 |ip on th|e server|
|000062a0| 0d 0a 7d 0d 0a 0d 0a 2f | 2f 20 54 65 6c 6c 20 69 |..}..../|/ Tell i|
|000062b0| 74 20 79 6f 75 72 20 63 | 75 72 72 65 6e 74 20 74 |t your c|urrent t|
|000062c0| 68 72 6f 74 74 6c 65 2c | 20 61 6e 64 20 69 74 20 |hrottle,| and it |
|000062d0| 77 69 6c 6c 20 67 69 76 | 65 20 79 6f 75 20 61 6e |will giv|e you an|
|000062e0| 20 6f 75 74 70 75 74 20 | 74 6f 72 71 75 65 0d 0a | output |torque..|
|000062f0| 2f 2f 20 54 68 69 73 20 | 69 73 20 63 75 72 72 65 |// This |is curre|
|00006300| 6e 74 6c 79 20 6c 69 6b | 65 20 61 6e 20 65 6c 65 |ntly lik|e an ele|
|00006310| 63 74 72 69 63 20 6d 6f | 74 6f 72 0d 0a 66 75 6e |ctric mo|tor..fun|
|00006320| 63 74 69 6f 6e 20 66 6c | 6f 61 74 20 45 6e 67 69 |ction fl|oat Engi|
|00006330| 6e 65 28 66 6c 6f 61 74 | 20 54 68 72 6f 74 74 6c |ne(float| Throttl|
|00006340| 65 29 0d 0a 7b 0d 0a 20 | 20 20 20 6c 6f 63 61 6c |e)..{.. | local|
|00006350| 20 66 6c 6f 61 74 20 74 | 6f 72 71 75 65 3b 0d 0a | float t|orque;..|
|00006360| 20 20 20 20 0d 0a 09 74 | 6f 72 71 75 65 20 3d 20 | ...t|orque = |
|00006370| 41 62 73 28 54 68 72 6f | 74 74 6c 65 29 20 2a 20 |Abs(Thro|ttle) * |
|00006380| 47 65 61 72 20 2a 20 49 | 6e 74 65 72 70 43 75 72 |Gear * I|nterpCur|
|00006390| 76 65 45 76 61 6c 28 54 | 6f 72 71 75 65 43 75 72 |veEval(T|orqueCur|
|000063a0| 76 65 2c 20 57 68 65 65 | 6c 53 70 69 6e 53 70 65 |ve, Whee|lSpinSpe|
|000063b0| 65 64 29 3b 0d 0a 0d 0a | 09 47 72 61 70 68 44 61 |ed);....|.GraphDa|
|000063c0| 74 61 28 22 53 70 69 6e | 53 70 65 65 64 22 2c 20 |ta("Spin|Speed", |
|000063d0| 57 68 65 65 6c 53 70 69 | 6e 53 70 65 65 64 29 3b |WheelSpi|nSpeed);|
|000063e0| 0d 0a 09 47 72 61 70 68 | 44 61 74 61 28 22 54 6f |...Graph|Data("To|
|000063f0| 72 71 75 65 22 2c 20 74 | 6f 72 71 75 65 29 3b 0d |rque", t|orque);.|
+--------+-------------------------+-------------------------+--------+--------+
Only 25.0 KB of data is shown above.