Jump to content
Leopard20

[WIP] Anti-Bounce System (ABS)

Recommended Posts

Anti-Bounce System (ABS)
by
Leopard20

D23uB3GrnhPV0NMQdl1Csqr3z8sRjIJb3qmvNZRf

This is a simple and lightweight addon that attempts to improve (not fix) the weird PhysX problem where the vehicles bounce up into the air in a ridiculous way.

I made this addon for my upcoming AI mod, as they had a tendency to flip their vehicles a lot while driving. But I suppose it is worth using by players as well.

 

I have tried my best to make the vehicle movement look as natural as possible (basically no "teleporting"). There shouldn't be any undesirable side-effects (interference with normal vehicle physics)


Please note that the problem with PhysX cannot be fixed with a simple addon, because it is engine related. Also, please note that this mod is still work-in-progress, so do not use it in any serious missions until you've tested it and made sure it satisfies your needs.

I will try to improve the mod with your feedback, so please report all your issues and findings.

For comparison purposes, if you know of any similar mods, please let me know (I couldn't find any).


Mod Features:

Spoiler

 

1. Anti-Bounce System: Attempts to prevent the vehicle from flying into the air upon contact, caused by sharp edges in geometries (which apparently impart a large torque to the vehicle, thus sending it up into the air). It doesn't fix it completely however (due to vehicle acceleration):


This building is about 800 m east of Stratis Airbase, next to the end of a road which you should be able to find easily (GRID: 025055). You can also place the building yourself (Land_i_Stone_Shed_V1_F)
4AYNDm0DDr_HJJMHbfNJd-JL-fv1rwHRxdusbyTT

 


2. Un-flip assistant: Gives the vehicle a small "boost" to help it unflip. Note that it doesn't always work (especially if the vehicle is completely upside-down).
The vehicles gets back on its tracks due to the boost (force) itself. It doesn't "teleport" to that position (setVectorUp or other dirty methods) .
B9k4fnNPxhJvTrv08y-bPopPjFiyXQUZGchxl2kW


3. Manual unflipping: Use WASD keys to unflip your vehicle.
AgTBlg7RuF4oiuCGlkMOSGKrqazPYxe3Gmpj6DGq

 

 

4. Customize the mod features using CBA settings and keybindings.

 

5. Extremely lightweight (event handler based) and nearly zero performance impact, so it is used on all land vehicles.

 


Notes:

Spoiler

 

1. Testing:
The mod automatically activates for all land vehicles
. If you want to remove the features for testing, execute this code in the debug console (in case you don't know what it is, it's the black box that you see when you pause the mission in editor):


[vehicleName] call ABS_fnc_removeEHs

vehicleName is the name of the vehicle you want to test. If you want to test it on the player's vehicle, you can use this code instead:


[vehicle player] call ABS_fnc_removeEHs

 

To re-activate, use this code:


[vehicleName] call ABS_fnc_addEHs


2. Customization:
CBA Settings: [Pause menu] -> Game -> Configure Addons -> Anti-Bounce System    or     [Pause menu] -> Addon Options -> Anti-Bounce System

CBA Keybindings: [Pause menu] -> Controls -> Configure Addons -> Anti-Bounce System

3. Multiplayer Compatibility:
The mod should be MP-compatible, but I haven't tested it yet. So if you want, you can give it a go in a casual test mission.

 

4. Source code:
The source code is available on GitHub. If you want, you can improve the mod in your own way!

 


Download:
Steam Workshop

GitHub

Armaholic

 

Installation:

Spoiler

Unpack the zip file to get the @AntiBounceSystem folder.Copy the mod folder to your launcher's watched folder (default location is the installation directory of Arma, which you can find by right clicking on your game in Steam library)
You can also check out this guide:
https://www.armaholic.com/page.php?id=29755


Requirements:
Community Base Addons (CBA)

  • Like 12
  • Thanks 5

Share this post


Link to post
Share on other sites

This is great !  Many thanks @Leopard20.  It really annoys me that devs have let something like this through for so long.  Once again the community comes to fix a problem.

  • Like 1
  • Thanks 2

Share this post


Link to post
Share on other sites

Hah, awesome banner!

 

I haven't tried the mod yet but I'm curious about auto un-flip thingy. I dunno how much you can do but do you think it's feasible to make it so you can like wiggle a vehicle using movement keys and un-flip a vehicle that is completely upside down? I'm probably explaining this really poorly but in some games you can like hold left and right couple of times and the car kinda gains some rolling momentum until it rights itself back on wheels.

 

@kremator, yeah that.

  • Like 1

Share this post


Link to post
Share on other sites
5 hours ago, kremator said:

This is great !  Many thanks @Leopard20.  It really annoys me that devs have let something like this through for so long.  Once again the community comes to fix a problem.

Thanks! 

It doesn't fix it completely. I tried fixing it but since the vehicle has an absurdly large acceleration, it just cannot be stopped in a natural way. 

The current trick works better on heavier vehicles such as tanks. 

 

 

4 hours ago, Janez said:

Hah, awesome banner!

 

I haven't tried the mod yet but I'm curious about auto un-flip thingy. I dunno how much you can do but do you think it's feasible to make it so you can like wiggle a vehicle using movement keys and un-flip a vehicle that is completely upside down? I'm probably explaining this really poorly but in some games you can like hold left and right couple of times and the car kinda gains some rolling momentum until it rights itself back on wheels.

Thanks!

I think it is possible. It's actually a really cool idea! I'll see what I can do.

 

I think by some games you mean GTA?! 😉

  • Like 1

Share this post


Link to post
Share on other sites
11 hours ago, Leopard20 said:

I think by some games you mean GTA?! 😉

 

Haha, yeah mainly but pretty much any arcade racer pre ~2007. Now they have those auto respawns that do nothing for 30s if you land upside down but respawn you instantly if you land on your wheels. Well, not exactly instantly, it needs another 15s to calculate your respawn point (it's actually plotting to set you up for another crash). Why Forza, whyyy?

  • Haha 1

Share this post


Link to post
Share on other sites

Update:
https://github.com/leopard20/Anti-Bounce-System/releases/
 

Added:

1. Manual Unflipping using WASD keys (can be changed using CBA keybindings): You can now unflip your own vehicle using WASD keys! Thanks to @Janez for this cool idea!
There are two modes: Tap and Hold mode. Hold mode runs every frame when you press the key (see customization options). It looks better, but it always checks the condition, even if you're not in a vehicle, or your vehicle isn't upside down. So technically it's a waste of performance. But I promise you it won't have any noticeable effect, unless you're aiming for 1000+ FPS! 😉 (I use lazy condition check, plus they're all really fast conditions)
If you're still not convinced, feel free to use TAP mode.
AgTBlg7RuF4oiuCGlkMOSGKrqazPYxe3Gmpj6DGq

You can also set the angle at which the mod unflips your vehicle! Default is 60 degrees.

 

2. Customization options (CBA Settings)
Many new options, both CBA settings and Keybindings.

  • Like 3

Share this post


Link to post
Share on other sites

Update:

https://github.com/leopard20/Anti-Bounce-System/releases/
# Improved:
* Manual unflip: Replaced moment with force for consistency (before this, a quad-bike would unflip so fast that it might have ended up spinning afterwards!)
* Slightly better auto-unflip

 

# Fixed:
* "Rightward unflipping" key was missing in hold mode!

  • Like 1

Share this post


Link to post
Share on other sites

F***ing amazing. Another proof BI should just hire entire BIF editing section to make Arma 4. 😎

  • Like 1

Share this post


Link to post
Share on other sites

With auto-unflip, could you lock vehicles to stop soldiers getting out and abandoning them? Losing a tank to stupid PhysX before it even reaches the battlefield is pure stupidity from BIS. 

 

Testing the previous version caught a few 'tank launch into outer space' moments but not all. 

Share this post


Link to post
Share on other sites
5 hours ago, kremator said:

With auto-unflip, could you lock vehicles to stop soldiers getting out and abandoning them? Losing a tank to stupid PhysX before it even reaches the battlefield is pure stupidity from BIS. 

This one is annoying to me to (it affects my own AI as well). I still haven't been able to fix it. I'll try my best.

 

5 hours ago, kremator said:

Testing the previous version caught a few 'tank launch into outer space' moments but not all. 

Did they literally launch up in the air?! 'cause that shouldn't happen.

I did however notice them gaining a supernatural lateral acceleration a few times. 

I have some ideas to fix this too. Let's see if one works.

Share this post


Link to post
Share on other sites

AgTBlg7RuF4oiuCGlkMOSGKrqazPYxe3Gmpj6DGq

 

Any chance you could have the Crew pop out have them reach under the tank with some sort of Deadlift animation have them growl nationalistic chants really loudly and have them heave the tank Right-Side-Up?

  • Like 1
  • Haha 3

Share this post


Link to post
Share on other sites

That would be hilarious .. however knowing the stupid AI they'd get squashed !

 

Share this post


Link to post
Share on other sites
2 hours ago, froggyluv said:

AgTBlg7RuF4oiuCGlkMOSGKrqazPYxe3Gmpj6DGq

 

Any chance you could have the Crew pop out have them reach under the tank with some sort of Deadlift animation have them growl nationalistic chants really loudly and have them heave the tank Right-Side-Up?

What?!!!! 😄
I don't think there are any such animations in the game!
Plus, doing it with the AI (especially vanilla) is a pain in the @$$!

Share this post


Link to post
Share on other sites
40 minutes ago, Leopard20 said:

Did they literally launch up in the air?! 'cause that shouldn't happen.

Yup .. I spawned about 30 tanks and told them to navigate through a small town.  Hilarity ensued (we know how bad the driving is anyway!).   I had at least one outerspace launch.

Share this post


Link to post
Share on other sites
2 hours ago, froggyluv said:

AgTBlg7RuF4oiuCGlkMOSGKrqazPYxe3Gmpj6DGq

 

Any chance you could have the Crew pop out have them reach under the tank with some sort of Deadlift animation have them growl nationalistic chants really loudly and have them heave the tank Right-Side-Up?

 

So the man is effectively alleviating issues and bugs that not even BI has been able to fix in almost a decade and you still want Arma 4 levels of immersion... COME ON DUDE be realistic!

 

@Leopard20 check your email regularly because if I was BI I would have already sent you an email with a job offer 😉

  • Thanks 1

Share this post


Link to post
Share on other sites
21 minutes ago, LSValmont said:

So the man is effectively alleviating issues and bugs that not even BI has been able to fix in almost a decade and you still want Arma 4 levels of immersion... COME ON DUDE be realistic! 

The idea itself isn't bad (kind of funny too!), but it could lead to more problems.

Share this post


Link to post
Share on other sites
1 hour ago, Leopard20 said:

The idea itself isn't bad (kind of funny too!), but it could lead to more problems.

 

Yeah and besides the focus of your mod shouldn't be lost. Keep it simple, fast and focused on the task since the task is already daunting 😉 

Share this post


Link to post
Share on other sites

Update:
https://github.com/leopard20/Anti-Bounce-System/releases/tag/v0.3


# Improved:
* Anti-Bounce:
The mod should be able to detect large lateral accelerations and cancel them as well!
* Auto-unflipping: Since the code is fast enough, it now runs the entire time (during PhysX contact only) to make sure the vehicle is fully unflipped. So it now has a 90%+ success rate!
I have removed the "jolt", because it might've made the vehicle fast enough to kill any infantry units in its way!.
* Manual-unflipping: It will cancel Auto-unflipping if it's currently in progress. So you don't need to enable the option "Disable automatic unflipping for player vehicles" anymore.
* Manual-unflipping: The force is now applied in alignment with the center of mass.


As a reminder, please note that the mod (except for manual-unflipping) only triggers when the vehicle has PhysX contact. So it shouldn't have any noticeable performance impact (unless you have hundreds of vehicles constantly colliding with each other or the environment)

@kremator
I couldn't find a solution for AI disembarking from flipped vehicles. The stupid AI leader just tells them to get out no matter what you do! But since the vehicle can get up successfully in most situations now, it shouldn't be a problem anymore.

  • Like 2
  • Thanks 3

Share this post


Link to post
Share on other sites

Does locking the vehicle not make a difference ?  Or prior to auto-flip you disableAI ... not a coder just a tinkerer so I could be talking out my ass 🙂

Share this post


Link to post
Share on other sites
18 minutes ago, kremator said:

Does locking the vehicle not make a difference ?  Or prior to auto-flip you disableAI ... not a coder just a tinkerer so I could be talking out my ass 🙂

Yeah, tried all those. Even a few "workarounds". Nothing.

  • Like 1

Share this post


Link to post
Share on other sites
On 7/11/2020 at 12:06 PM, LSValmont said:

 

So the man is effectively alleviating issues and bugs that not even BI has been able to fix in almost a decade and you still want Arma 4 levels of immersion... COME ON DUDE be realistic!

 

@Leopard20 check your email regularly because if I was BI I would have already sent you an email with a job offer 😉

 

I thought the "some kinda Deadlift animation" was the giveaway thats its all in jest mate. Would be hilarious tho..

  • Like 1

Share this post


Link to post
Share on other sites
1 hour ago, vuffin said:

This is very much needed, will try. 

 

About similar mods, sceptre has made one but for planes, https://github.com/SceptreOfficial/No-More-Aircraft-Bouncing

 

If it helps you or not, no idea.

 

Cheers

I just took a brief look at the scripts. It actually does something very similar, but not related to PhysX.
This is what it does:

1. It triggers when an air vehicle is killed.
2. Prevents upward velocity (similar to my mod, although my mod just damps it)
3. Slows down the falling plane while it's 5 meters above the next surface and its horizontal velocity is less than ~1.5 m/s. (again similar to my mod, when it detects large horizontal acceleration)

 

The biggest difference is that my mod does the process only once, while this mod does it per frame (as long as its moving faster than ~1.5 m/s).

Anyway, thanks for letting me know!

  • Like 1
  • Thanks 1

Share this post


Link to post
Share on other sites
5 hours ago, Leopard20 said:

I just took a brief look at the scripts. It actually does something very similar, but not related to PhysX.
This is what it does:

1. It triggers when an air vehicle is killed.
2. Prevents upward velocity (similar to my mod, although my mod just damps it)
3. Slows down the falling plane while it's 5 meters above the next surface and its horizontal velocity is less than ~1.5 m/s. (again similar to my mod, when it detects large horizontal acceleration)

 

The biggest difference is that my mod does the process only once, while this mod does it per frame (as long as its moving faster than ~1.5 m/s).

Anyway, thanks for letting me know!

 

So basically both mods do the same but yours is more efficient and works on all vehicles and not only Aircraft?

 

Is that correct?

 

Or even with your mod enabled we should also get this one?

Share this post


Link to post
Share on other sites
7 hours ago, LSValmont said:

 

So basically both mods do the same but yours is more efficient and works on all vehicles and not only Aircraft?

 

Is that correct?

 

Or even with your mod enabled we should also get this one?

No, my mod only affects Land vehicles. Air vehicles do not seem to be affected by the PhysX bug.

 

As for efficiency, since the two mods do completely different things, it's not fair to compare them that way. Even though I said "it does it per frame", the code was very fast so you won't see any negative side effects.

 

If you want, you can grab that one too. Seems to be working well!

  • Thanks 1

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×