Page 1 of 1

### Collision physics

Posted: 15 Dec 2012, 15:06
So the new collision system is alsmost perfect but it really needs somethings to have an amazing gameplay (i will try to explain with my bad english )

Kart should bounce when they hit each other (Maybe a bit less than most of MK-like and flippers )
Because when you are skidding and hurt someone else, you lose most of your speed this is very frustating.

-If you go very fast (compared to another kart) and collide (skiddind or not); your path will not change but the other kart will be pushed
-If you have the same speed as another kart and collide; both path will change a little bit but the other kart
-If you hurt a kart on his back, you will lose just a little part of your speed, and transfer your speed to the other kart

### Re: Collision physics

Posted: 18 Dec 2012, 02:08
I agree that collisions could still be a bit better. This is very, very difficult to get right though, so I can't tell you precisely when it will be done

### Re: Collision physics

Posted: 06 Apr 2018, 00:24
First off, congrats for this awesome game !

Now, I don't know how it was back in 2012, but having played this game quite a bit (done nearly every possible combinations of games and tracks after finishing the campaign), I find the physics in some types of collisions very unrealistic and frustrating, to the point when I eventually decided to just restart the race almost every time one of those happens.

The 3 main issues for me :
• When colliding on a wall with sufficient speed, the kart sometimes makes a huge leap backwards (which takes forever). In the real world it wouldn't bounce at all, and we would expect a similar behavior in the game.

• when skidding while hitting a wall, the kart turns back in the opposite direction, which makes no sense whatsoever (the gifs may take a while to load) :

(Blackhill Mansion)

• some very thin objects collide with the karts - which gets unrealistic at very high speeds - while some bigger objects don't collide at all :

(Nessie's pond)

### Re: Collision physics

Posted: 06 Apr 2018, 03:17
The Rebound
The coefficient of restitution after a collision depends on the will of the track maker. The value can be set in the proper plugin on Blender. The author of a track may experience different values until he/she finds the most realistic rebound (or lack of, with COR=0 in an inelastic collision) according to the material and the shape of the object that suffers the impact. I will show you four examples:

My track before the correct settings:
https://youtu.be/RoHHIcQ-j-s?t=23s (the shock against the red and white tyres throw them ahead)
https://youtu.be/RoHHIcQ-j-s?t=1m24s (here, when the kart hits the monster truck tyre, the restitution is realistic)
https://youtu.be/RoHHIcQ-j-s?t=1m31s (when the kart hits the cones, you see a realistic effect too)

A track of other contributor before the adjustment:
https://youtu.be/xwj-Fcb79O8?t=1m31s

Passing Through
The author of a track can define if an object is solid or not (ghost). In the first case, the karts will hit it and rebound like shwoed above. In the case of a non solid object, the kart will pass through. This is mostly used in plants, strips, flags and streamers, but the person who makes a track may set as ghost/non solid a tree, a wall or any other object in order to facilitate the drives in a difficult point of the track where collisions are common:

In the case of the Scotch flag, the author assumed that you shouldn't collide with the mast. So, that's an "obstacle" for bad drivers. Anyway, we can allow the drivers to pass through a tree, a wall, etc., if they are off road and nobody needs to go there or if this make the things easier for the drivers.

### Re: Collision physics

Posted: 06 Apr 2018, 16:17
Thanks for the info.
In my opinion, karts should never bounce like rubber balls no matter what they hit. A real kart made of metal would crash against an obstacle and that's why it wouldn't bounce. So the game should not even allow such restitution values.

For the second issue I pointed out, I don't think you've addressed it, as it's a matter of rotation, not bounciness.

For the scottish flag, when you're racing with many other karts, you often get pushed to the border of the road (which is what happened to me and it doesn't matter whether you're a good driver or not), and this flag is right on the border. If this game had more interactivity with the environment, hitting it would destroy it. But the game doesn't, so it should either be a ghost object or be moved further away from the road.

While we are on Hacienda, yes, that pillar is a ghost, but I would put that on the account of bad design. Before I knew it was a ghost object, I always did my best to avoid it and instead bumped into all the other obstacles of this jump :

### Re: Collision physics

Posted: 07 Apr 2018, 05:35
Hi, again!

ChameleonScales {l Wrote}: In my opinion, karts should never bounce like rubber balls no matter what they hit. A real kart made of metal would crash against an obstacle and that's why it wouldn't bounce. So the game should not even allow such restitution values.

Well, you know why. It's Newnton's 3r Law as well the Law of Momentum Conservation. Even F1 or GT cars, that are way heavier than a kart, do not stick together when they collide with a wall or another car. If the game tries to reproduce the real World, the cars must bounce apart.

The harder you collide with another body, harder will be the reaction. When one or two bodies absorb 100% of an impact (eg.kart hitting blocks of hay), an inelastic collision happens and there's no bouncing. The bodies (kart and cubes of hay) stick together. A car or kart will not bounce if it (or the object) deforms its structure absorbing 100% of the impact (losing the greatest part of the system's energy). When one or two bodies doens't absorb 100% of the impact, the resultant momentum moves away one or both. The karts of STK don't deform graphic or physically. In other words: you can't see or fell some damage of their structure. So, the collision is inelastic, which means that they need to bouce apart after a collision.

In real World, karts and cars bounces after a collision most times, but in an "almost unpredictable" way in terms of direction, distance, movements and damage. The restitution and the new direction of a vehicle after a collision depends on many factors like material that suffers the impact, the coefficient of friction (COF) of the track/terrain/floor, strength of impact (which, by its side, depends on the mass and the speed of the bodies that collide), the angle of impact as well the shape of theobjects that suffers the impact.

1.Bouncing according to the material
A collision with a smooth body like hay will absorb the impact. Kart and hay stick together:
https://youtu.be/5rRDJmfTmGA?t=53s

Most collisions on STK are elastic due to the objects and respective materials. So, the karts must bounce to reproduce the real World.

2.Boucing according to the COF
A collision against the ice rock in a track like "On an Iceberg" should allow the kart to slide for a long distance until it collides again when running over slicking ice. But, when the karts gets out of the track and reaches the snow, the speed decrease drastically until it stops totally. The author of the track can set the COF for certain parts of the terrain. So, the speed may be high on asphalt and slow on the grass or beach sand and this defines how much the kart bounces in terms of distance.

3.Bouncing according to the strength of impact
If a vehicle hits a wall at 20km/h the damage is minor and the distance it will bounce until the stop is shorter than when it hits the wall at 120 km/h, of course (except for most straight collisions at 0º). So, it's okay to allow a rebound that is proportional to the impact. The harder you hit, the harder you bounce (Newton 3rd law).

4.Bouncing according to the angle of impact
ChameleonScales {l Wrote}:For the second issue I pointed out, I don't think you've addressed it, as it's a matter of rotation, not bounciness

ChameleonScales {l Wrote}:when skidding while hitting a wall, the kart turns back in the opposite direction, which makes no sense whatsoever

If the angle of impact or any other factor avoids the complete absorbing of energy, one or both do not absorb most part of the impact. Occurs an elastic or a partially elastic collision and the bodies do not stick together no matter the material:

In the real world, cars hitting a wall in angle cause a partially elastic collision. Then, the car (or kart) bounces in a mirrored way and reverse.

Disclaimer: graphic images of real crashes.
https://youtu.be/p_tt51pt9Jo?t=1m1s
https://youtu.be/VBV4Q4b0Ifo?t=14s
https://youtu.be/OvBda9CGlrU?t=1m50s

In the real life (except if the car hits a wall at an angle equal to 0), the car rebounds to the opposite side of the trajectory before the collision. What happens on STK? The contrary. The karts hit the wall and back in reverse, but by the same path returning to a previous position.

Probably, because it's an easier behavior/reaction to be programmed by the developers.

5.Bouncing according to the angle and shape of the wall/objects that suffers the impact
This one has to do with the previous (4). A curve or not plane surface makes the kart rebound according the angle of collision at some point.

Ghost or Solid?
Well, I don't like when objects works as ghost when the real objects (real trees, walls, columns, etc.) in the real World are not, except if it's proposital (eg. a ghost rack, a ghost door, etc. in a misteryous house). I don't like if the ghost objects should be solid, but were set as a ghost because they are on the normal path of the track and the author can't find a better solution. But, if the author of a track uses this trick in crytical points for bad drivers, no problem by my side.

Sorry for a possible mistake. It's 2:00 PM now.

### Re: Collision physics

Posted: 07 Apr 2018, 13:47
I firmly believe that karts should bounce very little to not at all upon collision, just as in other kart racers. We should be aiming to present simplified physics that feel right in the context of the game and give the the player as much control as possible.

### Re: Collision physics

Posted: 07 Apr 2018, 18:07
As far as the collisions go, I think it would make sense to cut the friction of the front two wheels down, so that the back wheels stay more stationary, but the front wheels bounce out, resulting in the kart facing in the direction the player was trying to turn. Hiker, any thoughts?

### Re: Collision physics

Posted: 07 Apr 2018, 23:59
Hiker is our physics 'expert' though he's quite busy these days, so he may not be around to answer just right now. In general though, invoking laws of physics, while not without merit, is not going to win arguments as STK is not a simulator and thus does not attempt to achieve realism. I do agree however that STK's collisions could feel better, there's a big difference however between discussing ideas and actually making them real as game physics engine are not easy to work with

### Re: Collision physics

Posted: 08 Apr 2018, 00:39
Just to be clear. As clear as possible: everybody knows that STK is an arcade game. I believe that nobody is trying to change the game into a simulator, but ChameleonScales criticized the behavior of the karts bouncing and the bounce itself. In his words:
ChameleonScales {l Wrote}:A real kart made of metal would crash against an obstacle and that's why it wouldn't bounce. So the game should not even allow such restitution values.

I did not agree, so, I tried to show him that makes no sense to cancel the bouncing because, even in the real World, cars and karts bounce apart after a collision. Then, I showed those physical laws that everybody already knowsjust to remember that some level of bouncing after a collision is the natural thing to expect. So, the game and its developers are correct keeping the karts bouncing. I even argued that the "unrealistic" bouncing that makes the karts turn back to a previous position, it is not "ugly" or wrong and, maybe, it is less complicated to program.

Upon realism, my arguments were in favor to keep the coherence of the game, since some developers prefer some level of realism. I'm not the guy with an obsession for realism, anyway. In my opinion, STK could have a cartoonish visual style and even more arcade physics. AFAIK, I am the only one who "invoked laws of physics" (and I wouldn't use something that everyone has studied as differential to win the discussion), but my opinion was explicitly in favor of the game as it stands at the moment and in favor of the developers. I thought it was clear in my text.

### Re: Collision physics

Posted: 08 Apr 2018, 13:10
GeekPenguinBR {l Wrote}:I thought it was clear in my text.

It was (at least for me, a native portuguese speaker as you). No need to take things personally here, as I do believe Auria was referring more to a often used argument than particularly answering your posts (even some of ChameleonScales' questions where somewhat based on real-world physics expected behaviour, as you pointed out, and I believe she wasn't directly answering him either).

Had worked a bit with Bullet Physics raycast vehicle (which AFAIK it's what is used/adapted on STK) for a Trigger Rally test, I do agree with what was said about being really hard to adapt things and make the physical behaviour both funny and acceptable. Changing parameters and/or modifying some implementations is often a nightmare to do and more often results on broken physics or totally unexpected behaviours.

### Re: Collision physics

Posted: 08 Apr 2018, 19:32
Hi, Farrer.

farrer {l Wrote}:
GeekPenguinBR {l Wrote}:I thought it was clear in my text.

It was (at least for me, a native portuguese speaker as you).

farrer {l Wrote}:No need to take things personally here, as I do believe Auria was referring more to a often used argument than particularly answering your posts (even some of ChameleonScales' questions where somewhat based on real-world physics expected behaviour, as you pointed out, and I believe she wasn't directly answering him either).

I'm definitely not taking this personally. I really doubt that Auria could misunderstand (and so badly) my comments defending the game and its developers. However, as she wrote (speaking to everyone and nobody), it is unclear who she "blamed" for wanting to change STK into a simulator. It got worse when she said "...invoking laws of physics, while not without merit, is not going to win arguments...", because who did it was me. Anyone who is too lazy to read everything that has been written and read only her answer can conclude "GeekPenguin is a moron. He criticized the physics of the game, tried to play an Einstein quoting laws of physics and he even wants to complicate the work of developers transforming the game into a simulator, but Auria came and put the idiot in his place."

farrer {l Wrote}:Had worked a bit with Bullet Physics raycast vehicle (which AFAIK it's what is used/adapted on STK) for a Trigger Rally test,

I took a look. Trigger Rally it's a cool game. I downloaded it.

### Re: Collision physics

Posted: 08 Apr 2018, 23:41
Honestly, sorry if I misread things a bit, but this thread is really long and I only had a few minutes so I kind of skimmed through since I didn't have the time to read everything in details. I didn't want to sound like I was blaming anyone, the gist of my reply is, very generally to all physics-related questions :

"we know physics are not perfect yet, and we intend to keep working on whatever it is that could make them more fun, but physics are hard and our manpower is limited so please allow for some time before it might happen"

None of that is personally aimed at anyone, it's just a broad and general statement about the state of STK physics

### Re: Collision physics

Posted: 10 Apr 2018, 15:45
Hi all,

sorry for the late answer, I was busy last week.

The bouncing issue is not related to any collision parameters directly (well, yes, but we have tweaked those already to make it better), it happens (more likely) when a kart has high speed and partially tunnels into an object. The way bullet works is it allows the overlap to happen, but then iteratively applies an impulse to push the objects away (or better: out) from each other. This sometimes results in the impulses being too big (esp. when the tunneling is bigger), which causes the bouncing/flying.

We have had some success in improving this by reducing the physics time step (i.e. makes it less likely for two objects to be deep inside of each other), but it can still happen. We cannot reduce the physics time step much further (since it introduces other stability issues). Making the karts slower would help

Once I am done with networking I will investigate a 'continuous collision' implementation that bullet also supports, which should stop the tunneling from happening (of course it will require more compute power - which I can't really quantify, esp with networking where a lot more physics need to be done). Iirc at the time we started bullet that world was work-in-progress, so we used the discrete time stepping one. The continuous collision world _might_ resolve this issue, but don't expect any changes soonish (unless someone wants to contribute, then please contact me).

Cheers,
Joerg

### Re: Collision physics

Posted: 25 Sep 2018, 15:33
I think what the OP is getting at is the karts do not seem to carry momentum and also behave somewhat like a cube on impact. Instead of turning or spinning when catching an edge on an obstacle, and thus losing momentum or being mildly diverted with some relatively cartoony effect (so that we don't go down the road of complex collisions and flipping upside etc) the kart acts as if it it was a flat facing object that has hit a flat wall, or even a flat bouncy wall.

### Re: Collision physics

Posted: 25 Sep 2018, 19:15
I should mention that impacts have been tweaked once again in the git version.