TurretsPhysicsPatch
Changes the bullet physics related to motion. More specificaly changes drag to be quadratic and forces a fixed update rate to make bullet motion independent of framerate. Works post update, but is build for pre update.
| Date uploaded | 2 years ago |
| Version | 0.2.0 |
| Download link | TCTC-TurretsPhysicsPatch-0.2.0.zip |
| Downloads | 5648 |
| Dependency string | TCTC-TurretsPhysicsPatch-0.2.0 |
This mod requires the following mods to function
BepInEx-BepInExPack_ROUNDS
BepInEx pack for ROUNDS. Preconfigured and ready to use.
Preferred version: 5.4.1900README
Turret's Physics Patch
This patch changes the update method in MoveTransform to a more accurate equation of motion, and changes the drag to be quadratic instead of constant. Also locks the rate at which the bullets update their position at 70 hz. This results in the bullet's motion being independant of framerate.
Bullet motion without drag remains largely unaffected.
This mod can exhibit strange behavior when a player has a high bullet velocity and drag. This is a result of the numerical integration used, RK4 does somewhat aleviate this.
If you notice any issues, please post in the rounds modding discord. I will look at the bug reports channel from time to time.
Small note: I haven't been able to test the added functions since the update, they worked before and the patch seems to work now.
Changes
EOM: at^2 + v0t + s0 --> a = F , v = da/dt, x = dv/dt.
Drag: a = D --> a = D*V^2 * 3/ 400.
Update rate: per frame --> 70 hz.
Adds some functions that impact the acceleration.
Added functions (These are added to MoveTransform)
add_variate_acceleration (2 overloads)
- Adds a function to the acceleration equation
- this function must be of type Func<float, float, float> or list<Func<float, float, float>>
- the order of parameters of the function is time then velocity
- if list is used index 0 indicates x and index 1 indicates y
- if the equation only holds in one direction the direction parameter can be used instead of the list
- 'x' for x
- 'y' for y
- the equation is activated at t (time since shot for the bullet), the input value should be in the future for all players as to keep the trajectory the same for each player.
add_constant_acceleration
- Adds a constant acceleration
- Requires a Vector3 but only x an y are used
- the acceleration is added at t (time since shot for the bullet), the input value should be in the future for all players as to keep the trajectory the same for each player.
rungekutta4 (2 overloads)
- Performs RK4 integration scheme
- dir vector consists of position (x) then velocity (y)
- t is used as input to func
- dtt is used as input to RK4
CHANGELOG
Turret's Physics Patch
V 0.2.0
Added acceleration support - function for altering acceleration equation - Now works with functions instead of classes
changed the update rate - 90 hz to 70 hz
changed the drag coefficient conversion - factor from 0.015 to 0.0075
changed the integration scheme - from forward euler to Runge Kutta 4
removed fix for high bullet velocities with drag - Reason: new itergration scheme has a higher speed tolerance.
removed unnessesary dependancies - UnboundLib - MMHook - ModdingUtils
V 0.1.0
(not published)
Added acceleration support - Dirac pulse (2 overloads) - square pulse - step - custom can be done using the class
changed the drag coefficient conversion - factor from 0.01 to 0.015
changed the update rate - 70 hz to 90 hz
Added a fix for high bullet velocities with drag - If the change in velocity due to drag is greater than the velocity then velocity will be reduced by 70% instead.
V 0.0.5
initial release