• Advertisement

Vu Chi Thien

Member
  • Content count

    14
  • Joined

  • Last visited

Community Reputation

0 Neutral

About Vu Chi Thien

  • Rank
    Member

Personal Information

  • Interests
    Production
    Programming
  1. Limited-Slip Differential and friends

    Thanks for passing by @CombatWombat, The vehicle simulation scene on gamedev.net is pretty quiet I agree, unlike the 2004-2007 period. Surprise. I actually didn't look at this wiki page yet for some reason. I just read on the differential wiki page, but not this one. This even has equation for torque output, so convenient. A bit stupid but, the torque input at the differential should not be multiplied by differential gear ratio correct? So instead of engineTorque * gear * diffRatio, just engineTorque * gear. Also the diff is only sensitive to the input torque from the engine to be activated, and I don't have to worry about the rolling resistance torque from the wheels, correct (in term of vicious clutch and ramp type)? Oh so my early understanding of the model is not correct. I've always think of the output torque to the wheels through the diff as the ratio based on the difference between torque or speed of two wheels, say: ratio = leftSpeed/rightSpeed torqueToRight = torqueIn * ratio; torqueToLeft = torqueIn* (1 - ratio); Another tricky thing is 4WD and AWD, because I would need a total of 3 diffs: 1 center, 1 front, 1 rear. 4WD is a bit easier, as the center diff only needs to lock up on demand, and LSDTorque needs to be a large number enough to keep the front axle spinning at the same speed as the rear one . If the front diff is open then it is easier as the torque over there at each wheel can just be EngineTorque * gear / 4. Factoring the locking at the center, to make sure the front axle spins at the same speed as the real axle, LSDTorque can be divided and distributed equally between 2 front wheels, so something like: //front axle speed frontSpeed = (LF + RF) * 0.5f; //rear axle speed rearSpeed = (LF + RF) * 0.5f; //speed difference between front and rear axle //this is the case when front spins faster axleDifference = frontSpeed - rearSpeed; //LSDTorque at center diff to be delivered at front and rear axle centerLSDTorque = axleDifference * lockUpForce; //torque from center diff to front open diff frontDiffInput = (outPutTorque * 0.5f) - centerLSDTorque; //torque to each front wheel LF.torque = RF.torque = frontDiffInput * 0.5f; //same for rear axle //torque to rear diff rearDiffInput = (outPutTorque * 0.5f) + centerLSDTorque; //torque to rear wheel, open diff LR.torque = RR.torque = rearDiffInput * 0.5f; //if LSD if (LSD) { //speed difference of 2 wheels, left wheel is faster speedDiff = LR.speed - RR.torque; //calculate LSDTorque, 1 way for now, simplicity rearLSDTorque = preload + driveTorque * ramp * friction; //distribute LSDTorque to rear wheels LR.torque = 0.5f * rearDiffInput - speedDiff * (rearLSDTorque); RR.torque = 0.5f * rearDiffInput + speedDiff * (rearLSDTorque); } //I guess the rearLSD model can also be applied to the front if the front has LSD also. AWD is trickier since I have to factor in and carefully monitor torque distribution between front and rear. Also each car manufacturer has their own AWD system which makes thing much more confusing, from OpenDiff with braking to Subaru's snowTrek and Audi's Quattro. I guess I can take the above 4WD model and change the centerLSDTorque around, with some if's else's. Again thank you very much. My progress has been skyrocketing ever since you helped me.
  2. Hi fellow game devs, First, I would like to apologize for the wall of text. As you may notice I have been digging in vehicle simulation for some times now through my clutch question posts. And thanks to the generous help of you guys, especially @CombatWombat I have finished my clutch model (Really CombatWombat you deserve much more than a post upvote, I would buy you a drink if I could ha ha). Now the final piece in my vehicle physic model is the differential. For now I have an open-differential model working quite well by just outputting torque 50-50 to left and right wheel. Now I would like to implement a Limited Slip Differential. I have very limited knowledge about LSD, and what I know about LSD is through readings on racer.nl documentation, watching Youtube videos, and playing around with games like Assetto Corsa and Project Cars. So this is what I understand so far: - The LSD acts like an open-diff when there is no torque from engine applied to the input shaft of the diff. However, in clutch-type LSD there is still an amount of binding between the left and right wheel due to preload spring. - When there is torque to the input shaft (on power and off power in 2 ways LSD), in ramp LSD, the ramp will push the clutch patch together, creating binding force. The amount of binding force depends on the amount of clutch patch and ramp angle, so the diff will not completely locked up and there is still difference in wheel speed between left and right wheel, but when the locking force is enough the diff will lock. - There also something I'm not sure is the amount of torque ratio based on road resistance torque (rolling resistance I guess)., but since I cannot extract rolling resistance from the tire model I'm using (Unity wheelCollider), I think I would not use this approach. Instead I'm going to use the speed difference in left and right wheel, similar to torsen diff. Below is my rough model with the clutch type LSD: speedDiff = leftWheelSpeed - rightWheelSpeed; //torque to differential input shaft. //first treat the diff as an open diff with equal torque to both wheels inputTorque = gearBoxTorque * 0.5f; //then modify torque to each wheel based on wheel speed difference //the difference in torque depends on speed difference, throttleInput (on/off power) //amount of locking force wanted at different amount of speed difference, //and preload force //torque to left wheel leftWheelTorque = inputTorque - (speedDiff * preLoadForce + lockingForce * throttleInput); //torque to right wheel rightWheelTorque = inputTorque + (speedDiff * preLoadForce + lockingForce * throttleInput); I'm putting throttle input in because from what I've read the amount of locking also depends on the amount of throttle input (harder throttle -> higher torque input -> stronger locking). The model is nowhere near good, so please jump in and correct me. Also I have a few questions: - In torsen/geared LSD, is it correct that the diff actually never lock but only split torque based on bias ratio, which also based on speed difference between wheels? And does the bias only happen when the speed difference reaches the ratio (say 2:1 or 3:1) and below that it will act like an open diff, which basically like an open diff with an if statement to switch state? - Is it correct that the amount of locking force in clutch LSD depends on amount of input torque? If so, what is the threshold of the input torque to "activate" the diff (start splitting torque)? How can I get the amount of torque bias ratio (in wheelTorque = inputTorque * biasRatio) based on the speed difference or rolling resistance at wheel? - Is the speed at the input shaft of the diff always equals to the average speed of 2 wheels ie (left + right) / 2? Please help me out with this. I haven't found any topic about this yet on gamedev, and this is my final piece of the puzzle. Thank you guys very very much.
  3. Hi fellow game devs, With the help of @CombatWombat in my previous post about clutch modeling, I now have a solid direction for the modeling the clutch. The way I'm doing it is having 2 clutch states: locked and unlocked. EngineRPM and torque will be calculated separately in each state. My problem right now is the logic and code for specifying locking and unlocking. The condition for locking is when (engineSpeed - drivetrainSpeed) in previous update cross zero (different sign) with the current update (to determine if engineSpeed = drivetrainSpeed or not in-between updates) and engineTorque <= clutchTorque. The condition for unlocking is when engineTorque > clutchTorque. The diagram looks roughly like this (taken from matlab website with the similar implementation): However, the 2 conditions are triggers for switching states, not for determine the current state to be in, so in the end my clutch state just jumped around. I don't have a lot of experience in doing state machine, so can some one give me rough code of how to implement this? Below is my rough code: speedError = engineSpeed - drivetrainSpeed; if ((Math.Sign(speedError) != Math.Sign(deltaW) && currentTotalEngineTorque <= clutchReactTorque)) { clutchLocked = true; } else clutchLocked = false; deltaW = speedError; //end of update I think the main struggle is the cross zero. Because cross zero is the "trigger condition" to check if the clutch should lock when it is slipping, not the condition for continuous locking, while the code I have above is the "continuous condition" saying "this condition is true then it is locked/unlocked". Another word, if the clutch is slipping, the condition above would decide if it's locked or not, but once it is locked, the cross zero condition is not true anymore (since speedError and deltaW have same sign as engineSpeed == drivetrainSpeed when clutch is locked). I'm sorry that I cannot explain this better as English is not my first language.
  4. Clutch Modelling Help

    OK, so with non-locking model, there will always be a little bit of oscillation when delta velocity gets smaller, but eventually gets averaged after enough timestep, and the output at the frame update is smoothed. And with high torque cases (super cars, race cars, high power trucks ...) we need small timesteps/high frequency. So basically like: if (clutchLocked) { engineSpeed = wheelSpeed * Gear; torqueAtWheel = (engineTorque * Gear) * diffBias; } else { engineSpeed += (engineTorque - clutchTorque)/engineInertia; torqueAtWheel = clutchTorque * Gear * diffBias; } I'm still experimenting with different values and having fairly good result at high speed, high engine RPM, but still lots of jittering at low speed low gear and high torque. One reason for the jittering is actually because of the built-in physic engine, so I also have to play around a lot with the timestep and substep config of the engine itself, which is going to take a long time. This problem occurs with everyone I asked in the official forum and no one has the solid solution yet. Talks about impulse, I bumped into this forum post of an open-source racing sim, with used impulse for clutch modeling, and based on the engine - wheel speed difference. Basically this model calculate engine torque impulse and clutch resistance impulse, and the net torque drives the engine inertia: engineVelocity += (engineTorqueImpulse - clutchDragImpulse) / engineInertia; And here's the clutch impulse calculation: public float GetDragImpulse(float engine_speed, float drive_speed, float engineInertia, float drivetrainInertia, float ratio, float engineTorquedt){ float drivetrainInertiaR=drivetrainInertia/ratio; impulseLimit=clutch_position*torqueCapacity*Time.deltaTime; float lambda=(engineInertia*drivetrainInertiaR*(drive_speed - engine_speed) - drivetrainInertiaR*engineTorquedt)/(engineInertia + drivetrainInertiaR); lambda = Mathf.Clamp(lambda, -impulseLimit, impulseLimit); return lambda; } Here the topic: http://vdrift.net/Forum/showthread.php?tid=1617&page=2
  5. Clutch Modelling Help

    Thanks so much again. I'm still studying and testing around with the model you gave me in the xls. It will take a while for me to get good result and come up with a good combination of values. Still I have some confusion I would like to ask: So after trying different values, to me increasing the proportional and integral would result in getting to the desired value faster, but gives more oscillation at high time step. Lower values would result in a smother jump. So from here I think with high torque value using lower proportional and integral would be better, and higher values for lower torque. Because in the model discussing here in the topic, clutchTorque, which is frictionConstant * clutchInput, is used to drive the wheels. So say I have an example: The engine produce 400Nm maximum torque. The torque capacity of the clutch is 500Nm. So when the clutch is fully closed, would the full 500Nm of clutchTorque go to the wheels despite the engine cannot produce that much torque (max 400Nm)? This is the biggest confusion for me right now.
  6. Clutch Modelling Help

    The xls is you sent shines a lot of light on me. Thanks so much for that. I'm also using Euler at 100Hz. Still I have a lot of jittering at low speed delta (engineSpeed - wheelSpeed). Decreasing proportionalStrength and integralStrength helps somewhat, but that would let the speed delta increasingly large which led to power loss and the car cannot reach max speed at current gear. So this acts more like a torque converter like my first implementation. Say if I want to implement a model that uses constant clutchTorque like you gave earlier: then I can replace proportionalStrength * speedError with the frictionConstant, and keep integralStrength * integralError right? Since the integral part acts like sort of a "damping" that scale with speed delta, so when the delta is small the damping gets smaller. To me I would prefer this model you first shown since it acts more like a real clutch, which is what I'm going after. Also if I were to implement the locked model, then what would be the condition for lock-up? Since it's really hard to get speed delta to be exactly 0, using speed delta as the condition is not very good. Second is comparing torque of 2 sides with the clutch capacity, but at low engine or wheel torque, the torque will of course be lower than the capacity, which means the clutch would locked immediately. Also this is not very possible since I cannot extract reaction torque from the wheel side. Have you ever implement this and do you have any suggestion for this implementation? If you don't mind, I would like to ask what model did you use in your project, the clutch converter like type, the constant clutch torque type, or the locked clutch type? And what engine or language did you use? Again, thank you so so much for everything you have done until now. You were a big help to me.
  7. Clutch Modelling Help

    Oh! This, right here, is the source of my confusion about your implementation. I get it now. However I still have question. I other models I've looked at, they also use this torque to drive the wheels. In my understanding, this torque is the Capacity of the clutch, which means how much torque it can endure before it slips. Because of that I don't think of it as a torque to drive the wheel side. This leads to my other question: Say the engine is capable of outputting 400 Nm, and the clutchTorque is 500 Nm. If we use this 500 Nm clutchTorque to drive the wheels, then when the clutch is fully engaged, engineSpeed == wheelSpeed, 500 Nm will go to the wheel side instead of the maximum 400 Nm that the engine can output?
  8. Clutch Modelling Help

    Here is the demo video. Sorry for the buggy audio since I'm debugging a lot and there's little to no optimization at this moment. As you can see (and hear) the engine revs up to max while the wheel rpm keeps up. The Delta W in the inspector window on the right is (engineRPM - wheelRPM), and you can see that they never match, and wheelRPM tried to keep up very slowly. No matter how high the clutch strength value is, they never match. The clutch strength value now is 27. Unity 5.6.1f1 Personal (64bit) - DevelopmentTestTrack.unity - Car0 - PC, Mac & Linux Standalone _DX11_ 31-Jan-18 1_06_39 AMTrim.mp4
  9. Clutch Modelling Help

    Here is the debug log in a run at 1st gear and specs of the car: //In 1st gear launching EngineSpeed: 19.20 DrivetrainSpeed: 0.00 clutchTorque: 253.54 engineTorque: 63.55 engineOutput: -189.99 clutchOutput: 31.08 output: 485.07 //Accelerating EngineSpeed: 19.07 DrivetrainSpeed: 0.02 clutchTorque: 251.42 engineTorque: 100.46 engineOutput: -150.96 clutchOutput: 49.13 output: 766.80 EngineSpeed: 18.96 DrivetrainSpeed: 0.05 clutchTorque: 249.57 engineTorque: 128.12 engineOutput: -121.46 clutchOutput: 62.65 output: 977.87 //So the RPM did jump down until the engine output torque ie net torque is positive EngineSpeed: 16.43 DrivetrainSpeed: 10.16 clutchTorque: 169.31 engineTorque: 200.51 engineOutput: 31.20 clutchOutput: 200.51 output: 3129.79 EngineSpeed: 16.46 DrivetrainSpeed: 11.47 clutchTorque: 134.66 engineTorque: 200.55 engineOutput: 65.90 clutchOutput: 200.55 output: 3130.44 //HOwever eventually the engineRPM reach Max, but wheel RPM doesn't match, thus output torque is tiny. //Also the rev limiter kicked in making engineTorque 0, making the engine the same speed but wheel speed also never match //and the final output torque can't accelerate the wheels anymore. EngineSpeed: 19.46 DrivetrainSpeed: 19.27 clutchTorque: 5.38 engineTorque: 5.38 engineOutput: 0.01 clutchOutput: 5.38 output: 84.01 EngineSpeed: 18.20 DrivetrainSpeed: 15.34 clutchTorque: 77.11 engineTorque: -118.47 engineOutput: -195.58 clutchOutput: -118.47 output: -1849.13 Subaru BRZ: 1st gear: 3.63 Final drive: 4.3 I actually had wheelspin when launching, but after that, the engineRPM accelerated way ahead of the wheelRPM though clutch fully engaged, and engineRPM kept staying at max, and wheelRPM slowly caught up after, which is not real. So it's a chase between the wheelRPM and the engineRPM. It's like the clutch was too weak. But increasing clutchStrength would cause haywire due to large number. I will post a video later to demonstrate.
  10. Clutch Modelling Help

    Thanks for the awesome reply. clutchTorque = (engineSpeed - driveTrainSpeed) * (1.0f - clutchInput) * clutchStrength * gearClutch; Oh OK I understand now. So basically I can imagine this as the engine driving the gearbox directly, but the two can be taken apart to spin independently. This is where I lost it. So based on the model of clutchTorque clutchTorque = (engineSpeed - driveTrainSpeed) * (1.0f - clutchInput) * clutchStrength * gearClutch; if this clutchTorque is used to drive the wheels, then there will be torque only if there is different in engineSpeed and wheelSpeed, ie torque is highest if clutch is slipping like crazy, which is not correct. And since this torque is fed back to the engine, then the engine speed would going up and down in a unrealistic manner. Another thing is that the engine torque does not go to the wheels but only the reaction torque does, which is which is a very small amount of torque. Looking at the diagram (which is the best by the way), the way I understand it is that the engineNetTorque drives the flywheel, which is sideA. A fraction (0 - 100%) of that torque must affect/output to sideB, and how much of engineNetTorque is going to sideB depends on the amount of space in between sideA and sideB. Or actually a fraction of combustionTorque (not netTorque) is going to sideB and the amount depends on the space in betweeen. The same with reaction torque on engine, the amount of that reactionTorque depends on the space as well. This is the biggest confusion in all the clutch model I've looked at. Would you mind explaining a little bit more on this? Also one thing to note is that in the current physic engine I'm using (Unity3D), there is no way to extract roadReactionTorque at the wheel to feed back on the engine, so wheelReactionTorque = roadTorque + torque friction is a no go (well if that's the only way and its necessary in this model). That's why I'm replacing the whole wheelReactionTorque with the above (engineSpeed - wheelSpeed). Second is that it is not possible to manually modify rpm, so wheelRPM += wheelAcceleration is a no go either. The way it works is that I give the wheel a torque value and the engine would integrate and return the rpm and slip based on the slip tire force curve (Pajeka like curve). However it is possible to get angular momentum of the wheels since wheel mass, radius and rpm are exposed. So is there any way to extract torque from angular momentum (or impulse) to apply to the roadTorque + torqueFriction model?
  11. Clutch Modelling Help

    Hi. Thank you so much for your reply. Yes you gave me some precious light when I'm in total darkness like right now. Actually my model I'm thinking of doing right now is very similar to what you've said, having a clutch with states. Before this I've looked this model from Matlab: https://www.mathworks.com/help/simulink/examples/building-a-clutch-lock-up-model.html It's a very clean implementation, but doesn't fit Unity3D's physic engine too well, so I have to modify it and ended up with the model posted above. I'm thinking of making the clutch as a separate C# class, integrate as a separate object and output appropriate torque to engine and wheel side. The stuff I posted here is what I'm testing with the case of slipping clutch. In case of locked clutch, I'm thinking of just setting the engineSpeed to the wheelSpeed * gearRatio, and engineTorque * gearRatio goes straight to the wheel. To me it's easier since Unity3D's physic engine calculate the wheelSpeed of the wheel object (wheelCollider) for me based on how much torque I put in and the tire slip force setting. Also this is the "recommended way" of doing engineSpeed according to Unity, which I think is not the best. The hard thing is the slipping clutch. The downside of Unity's physic engine is that it does not expose the rolling resistance force and load of the wheel, so having wheel resistance torque acting back on the engine is not possible. The only way is to use wheelSpeed. However, it's possible to calculate the angular Momentum of the wheel because the physic engine exposes wheel radius, weight and speed. So is it possible to somehow convert the momentum of the wheel to torque and resist the engine? Also would you mind explaining this: What do you mean by sign changed? Is it like if sign(speedBefore) != sign(speedAfter) then clutchLocked So based on what you've said, I have this model in mind bool clutchLocked = false; //clutch open by default float engineTorque = lookUpCurve(engineSpeed) - friction - clutchResist; //find out if clutch is slipping //if engine torque overcomes clutch avaiable torque //or speed different higher than threshold (since can't use wheel resistance torque for now) if (engineTorque > clutchTorque || Abs(engineSpeed - wheelSpeed) > threshold) { clutchLocked = false; } else clutchLocked = true; if (clutchLocked) { engineSpeed = shaftSpeed; //when clutch locked engine speed == wheel speed over gear system //all available engine torque goes to the wheels clutchResist = 0; } else { //clutch slipping //engine torque drive the engine itself with resistance from clutch //not going dirrectly to wheels engineSpeed += engineTorque / engineInertia * deltaTime; clutchResist = (engineSpeed - shaftSpeed) * clutchInput * clutchStrength; } Of the locking check can be like this (according to how I understand what you've said): float speedDiff = engineSpeed = shaftSpeed; //when sign changes or torque at both side less than clutch torque, clutch is locked if ( sign(speedDiff) != sign(engineSpeed - shaftSpeed) || (engineTorque < clutchTorque && wheelTorque < clutchTorque) ) { clutchLocked = true; } else clutchLocked = false; What do you think? Would you mind giving me advises?
  12. Clutch Modelling Help

    Update: I sort of having a rough implementation of this, and my problem now is that the engine keeps on accelerating like there is no resistance torque from the clutch, and the output torque at wheel is tiny. Here is my code so far, I'm using (engineSpeed - wheelSpeed) for reaction torque, so that I can omit the if statements: //speed is in rad/s //torque in Nm //inertia in kg/m^2 //clutchStrength is abitrary, currently 10 //clutchInput goes from 0 (depressed, engaged) to 1 (pressed, disengaged) float clutchTorque = (engineSpeed - driveTrainSpeed) * (1.0f - clutchInput) * clutchStrength * gearClutch; //gear clutch is when in neutral gear which is ratio 0 float engineOutputTorque = currentTotalEngineTorque - clutchTorque; //the torque coming out of the engine, factored in friction and resistance from clutch float clutchOutputTorque = (engineOutputTorque + clutchTorque) * (1.0f - clutchInput); //the torque coming out of the clutch to drive the gearBox, the problem is somewhere here I guess. 1.0f-clutchinput is added later because torque is able the reach wheels even if clutch is disengaged, maybe problem related to this also. float outputTorque = clutchOutputTorque * currentGearRatio * finalDriveRear; //the torque coming out of the gearbox to drive the wheels currentEngineRPM += radsToRPM((engineOutputTorque * Time.fixedDeltaTime) / engineInertia) ; //accelerate the engine with the netTorque //finally drives the wheels RR.motorTorque = outputTorque / 2.0f; RL.motorTorque = outputTorque / 2.0f; So the problem maybe is that clutchTorque that resists engine is too low so the engine keeps on accelerating like there's no resistance at all. When shifting gear the engineSpeed doesn't jump back either. Also the input torque for clutch maybe is wrong. I'm specifying the net engine output torque as input, which maybe is wrong because only fraction of the engine output torque should be in the clutch when clutch is slipping. Or maybe the output altogether is wrong (which is engineOutputTorque + clutchTorque). Can someone take a look and give me some advice? Thank you very very much.
  13. Clutch Modelling Help

    Oh boy, what a warm welcome for a complete beginner like me. Looking at your implementation I just want to punch myself, because of how obvious and easy it is, and I'm here digging myself in all of the complicating maths. However I'm still confused in some places: I'm guessing this clutchReactionTorque is reactionTorqueA? Because when engine is faster than wheels, engine must be slowed down like this: Next is the gearBox: I thought the output of the gearbox should be what ever the engine is outputing through clutch * gearRatio? If the output torque is clutchReactionTorque, in this case I'm guessing reactionTorqueB. then the torque at the wheels will be very very small, because in this reactionTorqueB is just clutchTorque, which is clutchFactor * frictionCoefficient. Or maybe I guessing you meant clutchNetTorque = engineOutputTorque - reactionTorqueB; then this clutchNetTorque will be driving the gearbox, and then the gearbox torque now drives the wheels? So in my mind the model looks like this: engineNetTorque = engineTorque - frictionTorque + reactionTorqueA; clutchNetTorque = engineNetTorque + reactionTorqueB; gearBoxOutTorque = clutchNetTorque * gearRatio; wheelTorque = gearBoxOutTorque * diffBiasRatio; //use torque because Unity's wheelCollider RPM is read-only By doing this, both sideA (engine) and sideB (shaftIn) will be dependent on the reactionTorque at the clutch, and both sides will rotate freely, connected only by the clutch. shaftIn torque will affect both engine the engine and the wheels Then the cases for reactionTorque; if (sideA > sideB) //engine (sideA) is faster, brake engine, speed up shaft (sideB) { reactionTorqueA = -clutchTorque; reactionTorqueB = clutchTorque; } else if (sideA < sideB) //shaft is faster, brake shaft, speed up engine { reactionTorqueA = clutchTorque; reactionTorqueB = -clutchTorque; } else //equal speed, reactionTorque is 0 { reactionTorqueA = reactionTorqueB = 0; } Also I'm thinking about making reactiontorque = (sideA - sideB) * clutchfactor, that way the if statement can be omitted and only the applying the correct sign at sideA and sideB is needed. Any opinions on the above? Also kind of out-of-place but I also would like to ask about differential after the clutch model is done, is it OK?
  14. Clutch Modelling Help

    Hi fellow game devs, I'm working on a car simulator using Unity3D and currently stuck on implementing the clutch. Currently, my drivetrain model involves torque from engine and reaction torque from the drivetrain and is using Unity3D wheelCollider. My ultimate goal is to calculate engineRPM at each time step, from there lookup engineTorque from torque curve and send to the wheels through drivetrain. Known variables are wheelRPM (reported from wheelCollider, read only), wheelInertia (calculated from wheelMass and radius, reported from wheelCollider), and engineTorque from a torque curve. Right now for simplicity, I'm ignoring drivetrain inertia and the differential is open. This is my currently non-working procedure, I'm using the formula AngularAcceleration = Torque/Inertia, so each timestep engineVelocity += AngularAcceleration.wheelAngularMomentum is calculated using Momentum = Inertia * AngularVelocity. Take the sum angular momentum of all the driven wheels, convert that angular sum to torque by divide torque to detalTime, because deltaMomentum= Torque * deltaTime, so Torque = deltaMomentum / deltaTime (I don't know if I'm right or not here). This torque will be wheelReactionTorque. For engineCombustionTorque, I use a curve to look up torque at certain RPM. Then engineTotalTorque will be engineCombustionTorque - frictionTorque. This sum of torque is the torque at the engine acting on the flywheel.engineTotalTorque then drives the flywheel with its inertia engineInertia. This engineTotalTorque is resisted by the above wheelReactionTorque. So the netTorque is engineTotalTorque - wheelReactionTorque. This netTorque still drive only the flywheel which is engineInertia, but is resisted by the reaction torque from the wheels. So now the engineRPM is calculated using the formula AngularAcceleration = Torque/Inertia this way: engineRPM += netTorque / engineInertia * deltaTime. The biggest problem now is I don't know which force/torque will be transfered to the wheel and drives the wheels. Can you please help me out here? Second, I don't know where and how to put the clutch in-between, I'm thinking of have a clutchInput float in wheelReactionTorque, so when it's 0 ie clutch disengaged, no resistance torque, engine freely spin the flywheel. clutchInput > 0, percentage of resistance is there, engine now drives itself and the resistance. What do you think about this? Third, should the wheelResistanceTorque be modified with gearRatio before going back to the engine, say wheelResistanceTorque / gearRatio, or wheelResistanceTorque * gearRatio? If yes, should it be divide or multiply? I know that engineTorque going to wheel will have to be multiply with gearRatio, but what about the torque from wheel going back looking from the engine side? I'm planning to stick with built-in wheelCollider despite its drawbacks to save time. I would like to make some sort of "sim-cade" handling similar to GRID or TDU, where the physic and handling is arcade-y, but still involves real physic factors such as managing clutch, tuning suspension, etc, as oppose to fully arcade games like need for speed or burnout. Thank you guys very much in advance.
  • Advertisement