Page MenuHomeFeedback Tracker

The PhysX interface function addForce in Arma 3 does not work properly under certain circumstances.
New, NormalPublic

Description

I’ve discovered a new issue that significantly impacts my ability to make mods. Please watch this video:
https://drive.google.com/file/d/1CygBnlwNcEuAncX3PRmRs9v-SryI4g-D/view?usp=sharing

In the video, you'll see that units close to an explosion are completely unaffected by the addForce function (even if I repeatedly execute _object awake true). Meanwhile, units farther away do react correctly.

After thorough testing, I found the root cause: my script applies addForce immediately after the explosion. Units that are close to the explosion don’t respond at all, while those farther away — whose code execution is slightly delayed — do respond properly.

In other words, if I insert a short delay (sleep) after the explosion, then all units — near or far — respond correctly to addForce. What’s even stranger is that if I skip the explosion effects entirely and just apply addForce directly, then all units respond as expected without needing any delay.

Details

Severity
Major
Resolution
Open
Reproducibility
Always
Operating System
Windows 10 x64
Category
General
Steps To Reproduce
  1. First, download my mod from the following link: https://drive.google.com/file/d/1ybX4lsZcRVPlQyHWrR7--xMR-X9I-xGK/view?usp=sharing Note: My mod requires CBA and JSRS to function properly. Here are the links to both mods: CBA: https://steamcommunity.com/workshop/filedetails/?id=450814997 JSRS: https://steamcommunity.com/workshop/filedetails/?id=3407948300
  2. After loading the three mods above, run my mission file: https://drive.google.com/file/d/1sreZLX1Juan60ilwNs2dNTsLBa7wa1Fr/view?usp=sharing and you will see the issue.

Event Timeline

Here are the conclusions from my further testing:

I removed all explosion particle effects that were triggered at the same time as the shockwave script, and tested again — the issue still occurred.
This indicates that the problem is not related to particle density or FPS drops.

In contrast, when I executed the shockwave script on its own, the issue did not occur.
This suggests that the problem lies in how the script is executed, not in the script itself.

I went back to my mod and found the following in the file:
WarFXPE\ParticleEffects\config.cpp
Look for the class:
class TT_USAF_MOAB_explosion_effect_sqf_script_trigger
(You can use a text editor to search for it, as this file is quite large and hard to navigate manually.)

This is the special effect where I used the beforeDestroyScript parameter to call the explosion script.

I believe the issue is caused by how the beforeDestroyScript parameter invokes the SQF script.
I suggest checking how the engine internally handles the beforeDestroyScript parameter — specifically, whether anything is done before the script is actually executed.

After testing step by step, I discovered that the reason units weren't responding to the addForce function was because they had already been killed (this was an issue with my mod). So the conclusion is: addForce doesn't work on units that have just been killed — it takes a few seconds before it starts working normally. During that time, even executing _man awake true has no effect. Sorry for wasting your time. I think this case can be closed.

So now only two issues remain:

  1. Sometimes, after being blasted away by addForce, a unit may suddenly snap back to their original position.
  1. Sometimes, after being blasted away by addForce, a unit seems to hit an invisible wall — all their velocity is instantly nullified, and they start falling straight down.