Skip to content

Commit cefdab7

Browse files
committed
feat: Fix flawed logic on parabola, make it scale better
1 parent de70d3e commit cefdab7

File tree

2 files changed

+5
-8
lines changed

2 files changed

+5
-8
lines changed
Binary file not shown.

unreal-cpp-net-fps/SystemImpls/EcsactSystemImpls.cpp

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -62,12 +62,12 @@ auto example::fps::FinishPush::impl(context& ctx) -> void {
6262

6363
static auto push_radius_to_force(float radius) -> float {
6464
// TODO
65-
return 40.f;
65+
return 25.f;
6666
}
6767

6868
static auto push_radius_to_tick_count(float radius) -> int16_t {
6969
// TODO
70-
return 50;
70+
return 80;
7171
}
7272

7373
auto example::fps::FinishPush::PushEntities::impl(context& ctx) -> void {
@@ -109,7 +109,7 @@ auto example::fps::FinishPush::PushEntities::impl(context& ctx) -> void {
109109
ctx.add(Pushing{
110110
.tick_total = dist_tick_count,
111111
.tick_count = 0,
112-
.max_height = 1000.f * dynamic_force,
112+
.max_height = 400.f * dynamic_force,
113113
.force_x = push_dir_x * (force * dynamic_force),
114114
.force_y = push_dir_y * (force * dynamic_force),
115115
.force_z = push_dir_z * force,
@@ -145,14 +145,14 @@ auto example::fps::ApplyPush::impl(context& ctx) -> void {
145145
if(pushing.tick_count < pushing.tick_total) {
146146
velocity.x = pushing.force_x;
147147
velocity.y = pushing.force_y;
148+
pushing.tick_count += 1;
148149

149-
const int tick_peak = pushing.tick_total / 2;
150+
const float tick_peak = static_cast<float>(pushing.tick_total) / 2;
150151
const float a = pushing.max_height / (tick_peak * tick_peak);
151152

152153
velocity.z =
153154
-a * (pushing.tick_count - tick_peak) * (pushing.tick_count - tick_peak) +
154155
pushing.max_height;
155-
pushing.tick_count += 1;
156156

157157
ctx.update(pushing);
158158
ctx.update(velocity);
@@ -174,9 +174,6 @@ auto example::fps::ApplyVelocity::impl(context& ctx) -> void {
174174
// auto vel_y = std::to_string(velocity.y);
175175
// auto vel_z = std::to_string(velocity.z);
176176
//
177-
// std::string velocity_str =
178-
// ("Velocity: " + vel_x + ", " + vel_y + ", " + vel_z + "\n");
179-
// std::puts(velocity_str.c_str());
180177

181178
position.x += velocity.x;
182179
position.y += velocity.y;

0 commit comments

Comments
 (0)