Polishing cartoon kart physics

Polishing cartoon kart physics

Postby JTE » 13 Dec 2018, 15:01

Hi. New programmer here, still trying to find my way around the code.

At this point Super Tux Kart is a highly polished game and there are only around three distinct things which bother me about it. One is that when you bump into a wall, you come to a rigidbody full stop, and I would personally much rather have a significant amount of knockback applied in that situation, ideally enough to prevent the player from having to manually reverse to get their kart out of an unfortunate corner wedge. Can anyone point me in the direction of what I'd need to change or where I would need to insert code in order to generate a suitable cartoony physics reaction when contacting a wall?
JTE
 
Posts: 1
Joined: 13 Dec 2018, 14:45

Re: Polishing cartoon kart physics

Postby Auria » 14 Dec 2018, 00:17

Hi,

I will let hiker reply since he knows STK physics much better than I do, but here's a first pointer based on the limited information I have :

karts/kart.cpp in method void Kart::crashed

Be warned that physics is a particularly difficult thing to get right :)
Image
User avatar
Auria
STK Moderator
 
Posts: 2975
Joined: 07 Dec 2009, 03:52

Re: Polishing cartoon kart physics

Postby Wuzzy » 14 Dec 2018, 02:28

What are the other two things that bother you about STK?
I like bitcoins: 17fsUywHxeMHKG41UFfu34F1rAxZcrVoqH :-)
User avatar
Wuzzy
 
Posts: 852
Joined: 28 May 2012, 23:13

Re: Polishing cartoon kart physics

Postby hiker » 16 Dec 2018, 13:17

Hi,

JTE {l Wrote}:At this point Super Tux Kart is a highly polished game and there are only around three distinct things which bother me about it. One is that when you bump into a wall, you come to a rigidbody full stop, and I would personally much rather have a significant amount of knockback applied in that situation, ideally enough to prevent the player from having to manually reverse to get their kart out of an unfortunate corner wedge. Can anyone point me in the direction of what I'd need to change or where I would need to insert code in order to generate a suitable cartoony physics reaction when contacting a wall?

Code for handling this is actually still in STK, see:
{l Code}: {l Select All Code}
void Kart::crashed(const Material *m, const Vec3 &normal)
{
...
    if(m_kart_properties->getTerrainImpulseType()
                             ==KartProperties::IMPULSE_NORMAL &&
        m_vehicle->getCentralImpulseTicks()<=0                     )
    {
        // Restrict impule to plane defined by gravity (i.e. X/Z plane).
        // This avoids the problem that karts can be pushed up, e.g. above
        // a fence.
      ...

The problem is that this code resulted in some rare situations (requires high speed, i.e. a combination of zipper, nitro, skidding) in really odd physics behaviour: karts being pushed into the air, flying after a collision, karts rotating after a collision, ... e.g.: https://github.com/supertuxkart/stk-code/issues/3239 (I think there is more than one ticket, can't find the others atm). The code for the pushback was disabled in https://github.com/supertuxkart/stk-cod ... a8ae0584a4. I left the code in kart.cpp since I am still hoping that we might be able to improve this.

To do what you want to do, just remove this patch and play with the values. But please be aware that some people are good in creating strange physics behaviour (try hitting various terrain at very high speeds, typically skidding sideways into walls at various angles), and that there is a significant chance that we might not accept a change if it causes this kind of problem (we spent a lot of effort to get rid of unexpected physics issue).

Having said that - I totally agree that a push-back would be useful - but tweaking is likely a long and frustrating process :( I'd recommend to join our irc channel, some devs (alayan particularly) can probably tell you more details about the situations in which we had physics problems.

Cheers,
Joerg
hiker
 
Posts: 1435
Joined: 07 Dec 2009, 12:15
Location: Melbourne, Australia

Re: Polishing cartoon kart physics

Postby hiker » 20 Dec 2018, 08:04

Hi JTE,

have tried to play with the parameters? As I've said, it would be great if we could find a way to safely re-enable this!

Cheers,
Joerg
hiker
 
Posts: 1435
Joined: 07 Dec 2009, 12:15
Location: Melbourne, Australia

Who is online

Users browsing this forum: SaraBailey and 1 guest