Advertisement Jump to content
  • Advertisement

bmarci

Member
  • Content Count

    148
  • Joined

  • Last visited

Community Reputation

790 Good

About bmarci

  • Rank
    Member

Personal Information

Recent Profile Visitors

5453 profile views
  1. bmarci

    Arcade car physics

    Are you sure about the terms? What you described it should behave the other way around: soft = stick to ground, stiff = bouncy Technically: soft -> k = small number, stiff -> k = large number (k=spring stiffness) Are you applying spring forces "upwards" in global space or in the car's local frame? Also it seems you found one of the funniest problem with high speed driving (sharp bumps); If you are moving fast the car will move too much between two simulation steps. If you are stuck to the traditional 60Hz physics update and your car is moving at 200km/h, that means the wheel moves about one meter (!) between two frames. Even with not much bend in the road surface that could cause the wheel to sink 30-40cm underground, meaning a huge upwards spring force. Out of curiosity what are your spring values? I'd see something around 30-50K for a sports car and 200-250K for a formula 1 car.
  2. bmarci

    Arcade car physics

    This is exactly what I did in my simulation This is a quite good starting point: https://gafferongames.com/post/physics_in_3d/
  3. I second that Also a very simple method that could work: if ((abs(a.pos.x - b.pos.x) < a.size.x + b.size.x) && abs(a.pos.y - b.pos.y) < a.size.y + b.size.y) && abs(a.pos.z - b.pos.z) < a.size.z + b.size.z)) { ... you have collision ... } So the method is just like with circles or spheres, get the distance of their centers and if it's smaller than the sum of their sizes then they collide. With boxes you have to do 3 separate checks for each axis, but the principle is the same.
  4. Yes, the loss of kinetic energy was one of my first thought, but my concern was I couldn't tell that what portion of the energy loss is due to braking. Velocity is changed by aerodynamics, tire friction or even collision. And to tell the contribution ratio between brakes it seemed impossible Thanks, I'll give it a try! Hey, I'm glad if I can motivate people
  5. Hi, A few months ago I was curious about how to simulate tire/brake temperature and such things. At the end I had to figure it out by myself, and the first result seems to be convincing to me: The https://en.wikipedia.org/wiki/Newton's_law_of_cooling is a good starting point for basic cool-down, and how to change temperature. For heating up I could only use common sense, since these properties of tires are probably bigger secrets than actual Pacejka parameters So at the end I used these parameters that are already calculated in the simulation: Angular velocity, tire deflection, camber, CP velocity, slip vector and a whole bunch of coefficients (about 15 of them) so for heating up, go for something like this: ang_vel * deflection * rolling_coeff + ang_vel * deflection * camber * camber_coeff + slip_vector_len * deflection * friction_coeff Also a fancy thing that can be added as brake discs can heat up to 800°C or more it affects the internal temperature, that increases pressure, that makes the tire spring more stiff for cooling down I used a simple kind of heat transfer: move velocity, spinning speed and some base cool down factor were used to determine the speed of how quick the tire temperature interpolates towards the air temperature, and towards the road temperature at the CP. The whole equation is based on the temperature difference so the transition is not linear, and with a couple of parameters the speed can also be adjusted. At the end I didn't only calculate a single temperature value but an array of them, one for the internal temperature and 32 for the tire thread, as the wheel rolls the current rotation angle can be used as an index to this array. So relatively for free I have an effect of different wear and temperature over the tire, so a hard braking can ruin a certain area of the tire, and as it wears it changes the radius of the wheel, and changes a lots of things For the brake disc heat up I used the brake_torque to increase heat and the above method to cool it down to air temperature. Regarding tire wear, I used the same rolling and friction method scaling by some temperature-wear curve value, so different wear at various temperatures, overheating can melt down the rubber quickly...etc. And finally how that whole thing affects the final simulation? Using the wheel angle again to look up the properties at the CP, with a couple of pre-set curves (temperature-grip ratio, dirt-grip ratio, wear-grip ratio) I got a single scalar at the end, that goes into the tire formula (not scaling the final Fx/Fy, I scale some of the pacejka parameters instead) And yes, since yesterday the tire can get dirty and my life is getting even more complicated I hope I could give some idea to who is also into this topic, and if you are already an expert, please don't spare me with your ideas!
  6. bmarci

    Car physics ?

    Check your messages
  7. bmarci

    Car physics ?

    No worries, I may have the sources somewhere, I'll take a look when I get home. Anyway, don't be scared, just basic elementary school math is in there (ok maybe some high school stuff too) Professor stuff is when it's full of integral signs and all possible Greek letters are used in a single equation
  8. bmarci

    Car physics ?

    If you are really into this topic, there is a very interesting (and entertaining) read (if you haven't found it already), very simple and if you have some time to experiment... I made my first car stuff upon this paper many years ago and it was great fun http://www.asawicki.info/Mirror/Car Physics for Games/Car Physics for Games.html But if you are not in the mood, it comes with source that you can use
  9. Hi guys, Nowdays I have some spare time again to spend on my ever-lasting hobby simulation. Most of the dynamics are working fine, so I'm into adding some fancy stuff. And unfortunatelly these are more hard to find than decent tire parameters So they would be: 1. Tire temperature and all related like grip and wear 2. Brake temperature and efficiency 3. Fuel consumption I'd like to solve them in a simple way without getting involved with too much thermo-dynamics and I also don't want to simulate chemical/physical reactions between materials So more approximation than precise simulation. My ideas so far on details; 1. I already found some unofficial "measurement" data somwehere about temperature and grip factor, for both road and slick tires. The graph made it obvious that it's not a linear thing, the best solution I can imagine for this is to hand-draw a curve for temperature vs grip. According to rumors this method is used in some professional F1 games too The more difficult part of this is how to calculate the actual temperature. The only things I can think of are slip angle and slip ratio, or Fx and Fy. The Forces seem to be more reasonable because they account for tire load too. Also I'm sure the speed plays a very important role here, because not only the friction but also the rate of compression and decompression of the rubber make it heat up too. And then the temperature of the surrounding, ground and air ?! Also the wear can be a bit tricky, does it depend on heat and/or friction, I can only think of a hand-drawn graph again. 2. This can be a simple friction model, or as I read in a paper the brakes "absorb" the kinetic energy of the car when braking so that could also be converted to heat. So that can be an other approach, then again, the car can lose kinetic energy in many ways so it's hard to tell how much came from the brakes and how much from air resistance, tire friction or even colision. And again, a nice hand-drawn graph could help with break efficiency. 3. This one is also a good question. The increase of kinetic energy can be a good starting point, so knowing how much work was needed to accelerate the car to a certain speed is a good start. But what is the scenario when idle-ing in the parking lot, or just coasting. Or can it be calculated from the throttle position only? Since it controls how much petrol is going to the engine anyway, and adding the bias-throttle used to maintain the idle RPM. So, if any of you have idea, or experience to share, I'd be more than pleased. Any suggestion is welcome
  10. bmarci

    Clutch Modelling Help

    Hi, Just a quick addition. It seems you already experienced something related. The engine/gearbox speed will never be the same, so some torque is always applied and with small difference it'll overshoot the acceleration, and develops some vibration, and that could go wrong. So when I made mine, I had an open-locked clutch state. Open by default until the engine and gearbox "equal" speed, in practice, when the sign of the speed difference changes. So when locked, you don't need to add clutch torques any more, just apply the engine torque directly to the wheels like the whole thing was fixed together. And most importantly there should be a setting for the maximum clutch torque, that's the amount the clutch can deal with (this should be multiplied by the current clutch pedal position). If the engine or wheel reaction torque is greater than this the clutch starts slipping and gets open again, so you can apply those clutch torques again. I hope I could give some hint
  11. Hi, Great, meanwhile I found your other post regarding this issue, and managed to bring it to live in my code :) It has a bit of oscillation, but with reasonable threshold that can be "neglected".   thanks for the hint!
  12. Hello, It might have been asked earlier, but the question is not answered yet. I have a hobby vehicle simulation I've been doing in my free time and now I have some spare time to work with that again.   The main situation: My simulation is running at 1000Hz I use a custom swept-box collision with the environment, that is not satisfactory, sometimes inaccurate and not fast, it's ok for one car though.     I started playing around with bullet (again) and wondering if it could be used for collision and simulating other rigid bodies. My concerns: The bullet (and all other physics engines) run on low frequency 60Hz usually. My suspension and tire simulation needs higher frequency therefore the car's body must also be updated 1000times a second. And the problem is, it needs to collide with the environment, the other cars, and occasionally dynamic environment objects.     I tried setting the internal timestep of bullet to 1000Hz, but that way a bunch of boxes and convex hulls ate up most of my cpu time, so that's not an option. I also tried having a "dummy" dynamic object with no gravity that is updated according to my simulation (setting transform, linear and angular velocity that I calculated) It worked "somehow" but the collision response was weird and also sometimes it sank into static geoms and occasionally went through them. The kinetic body works "perfectly", but it doesn't collide with the environment also the dynamic bodies are just pushed away regardless of their mass. So, also useless.     I'm also thinking of not modifying the bullet's body directly  but adding forces/impulses to translate it to the position that I calculated. I'm not sure if it could work.     So, does anybody here have any experience with this kind of issue? I read about ghost objects, but it's quite hard to find usefull info on how to use them for this kind of purpose.   thanks in advance for any help or idea.
  13. More problems there:   The spring speed is not only the difference of the the last and current position. You should multiply it with the timestep. (1/60 if your simulation runs at 60Hz)     This one seems to be a hack because of this:       The 0.4 stiffness is too small, unless you are making RC cars, this value should be between 8000-10000 for street car, 30000-50000 for sports cars and around 200000 for a F1 car. Also the damping should be much smaller than stiffness, maybe 10-20% could be a good start. Later, if you want to be more fancy, real dampers have different characretistics with compressing (bump) and expanding (rebound). The bump should be smaller. an example: when you drive over a bump, the wheel should react much quicker than when you drive into a hole.   Also what Mike wrote about the signs are correct, and you should check the signs of contactDepth and contactSpeed. The depth should be negative when the car is on the ground, and the speed should be negative then the spring is compressing.
  14. bmarci

    Systems of gears (Car simulation)

    Hi, I remember this was the most mysterious part in my sim. I couldn't find any usefull info on the topic, not even here, only foggy and misleading docs everywhere, like it had been the most difficult problem of life, or something. It was very frustrating. I also remember trying what you did, just spinning the rear wheels (fake it) and managed to achieve quite believable result. And finally I god enlighted by myself :) I strpiped down the problem to a simple acceleration test in 2d (side view) having only one wheel. It was much easier to follow what the heck is going on.   First forget about the differentials, they make your problem even more difficult to get it right. Do a fixed axle for first.   So, in a nutshell; You have to differentiate two major cases, when the clutch is locked and when it's "slipping".   When locked, the whole stuffs rotates together and can be handled together. You can indeed derive the rpm from speed, but instead of using linear speed use the wheels angular velocity. Calculate the torque from the engine, through the gearbox to the wheels and accelerate only the wheel usng (torque_drive + torque_road) / effective_inertia As you accelerate the wheel calculate the rotation speed of gearbox and engine back from the wheel rotation. Pretty simple. When the clucth is not locked, you have to separate the engine and the rest of the driveline. Use the engine torque to accelerate the engine only, and do the same as in (1) to the gearbox to wheel acceleration with the difference of using a portion of engine torque. The "portion" is the amount that the clutch can transfer depending on the pedal position. Here is an extra torque created by the clutch that accelerates and decelerates these two to synchronize their speed. And the same as above calculate the gearbox rotation speed from wheel speed (the engine is calculated separately) And you are done. The only thing you have to take care of is when to open and close the clutch, and its only a relation between the pedal position and the amount of torque going through it.   I hope it was clear somehow. You'll need this: http://www.racer.nl/tech/effinertia.htm to calculate the inertia of the whole driveline or just part of it.   Regarding transmission efficiency, I didn't have an idea where to "put" it, so I just left it out. It looked cool without it, though. My guess would be, it's enough to use the efficiency "loss" once, when the torque is calculated that accelerates the wheel. The reaction is handled at the wheel too, it's "not going back" to the engine that way.
  15. bmarci

    How does Runge-Kutta 4 work in games

      Yes, it's my recreational hobby stuff that I make if I don't have anything else to do :D Doubles are 64bit !!! Racer is using 32bit floats and also 1000Hz update rate, so it should be fine too. I sent you the integrator docs in PM.
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!